Advantech Data Acquisition Modules ADAM 4000 Manual do Utilizador Página 27

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 429
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 26
Chapter 2
Chapter 2 installation Guideline 2
-17
Program Source Codes:
OPEN Command Button:
Private Sub Command1_Click()
' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input
' is used.
MSComm1.InputLen = 0
' Open the port.
MSComm1.PortOpen = True
End Sub
SEND Command Button:
Private Sub Command2_Click()
' Send Get AI command to ADAM-4011 Module at address 01H.
MSComm1.Output = "#01" & Chr$(13)
' Wait for data to come back to the serial port.
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, vbCr)
' Read the response till the carriage return character.
Text1.Text = Buffer$
' Display the reading.
End Sub
CLOSE Command Button
Private Sub Command3_Click()
' Close the serial port.
MSComm1.PortOpen = False
End Sub
Vista de página 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 428 429

Comentários a estes Manuais

Sem comentários