EasyManua.ls Logo

Elo TouchSystems ET1229L Series

Elo TouchSystems ET1229L Series
249 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section 5. Example Applications
43
If Err.Number <> 0 Then
' Process error using Err.Description
' contains error description for the demo,
' we'll just display it
txtInfo.Text = Err.Description
' Reset the error handling
On Error GoTo 0
' exit this sub
Exit Sub
End If
' reset the error handling
On Error GoTo 0
' send the command to get the port number
Put #1, , "/get port_name" + Chr$(10)
' get the response from driver which should contain the
' com port number
Get #1, , buf$
' Expected response:
' (character position in the response string)
' 11111111112222222222
' 12345678901234567890123456789
' e.g. "/get port_name COM14"
'+=========================================+
'|| IMPORTANT: CLOSE THE DEVICE DRIVER ||
'|| BEFORE TRYING TO REOPEN IT ||
'+=========================================+
Close #1
' Make sure we got back a valid response.
This checks that we have received a “/get” response and that
“port_name” and “COM” are present and in the right locations.
If Left(buf, 4) = "/get" _
And InStr(buf, "port_name") = 13 _
And InStr(buf, "COM") = 25 Then
' Just for information, display the com port number
txtInfo.Text = "Opening Serial IO on port " & Mid(buf, 25, 5)
' Get the port number value from character position 28
' (and 29 if two digits long) of the response
PortNumber = Val(Mid(buf, 28, 2))
'+------------------------------------+
'| open the driver as a serial device |
'+------------------------------------+
' make sure the on_comm function will be
' triggered by the device driver by setting
' the receive threshold to 1 (one)
MSComm1.RThreshold = 1

Table of Contents

Related product manuals