EasyManua.ls Logo

Lakeshore 211 - Page 49

Default Icon
96 pages
Print Icon
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...
Lake Shore Model 211 User’s Manual
Remote Operation 4-
9
Table 4-3. Visual Basic Serial Interface Program (Continued)
frmSerial.MSComm1.Output = strCommand & Term 'Send command to instrument
If InStr(strCommand, "?") <> 0 Then 'Check to see if query
While (ZeroCount < 20) And (strHold <> Chr$(10)) 'Wait for response
If frmSerial.MSComm1.InBufferCount = 0 Then
'Add 1 to timeout if no character
frmSerial.Timer1.Enabled = True
Do
DoEvents 'Wait for 10 millisecond timer
Loop Until frmSerial.Timer1.Enabled = False
ZeroCount = ZeroCount + 1 'Timeout at 2 seconds
Else
ZeroCount = 0 'Reset timeout for each character
strHold = frmSerial.MSComm1.Input 'Read in one character
strReturn = strReturn + strHold 'Add next character to string
End If
Wend 'Get characters until terminators
If strReturn <> "" Then 'Check if string empty
strReturn = Mid(strReturn, 1, InStr(strReturn, Term) - 1) 'Strip terminators
Else
strReturn = "No Response" 'Send No Response
End If
frmSerial.txtResponse.Text = strReturn 'Put response in textbox on main
form
strHold = "" 'Reset holding string
ZeroCount = 0 'Reset timeout counter
End If
Loop
End Sub
Private Sub Timer1_Timer() 'Routine to handle Timer interrupt
frmSerial.Timer1.Enabled = False 'Turn off timer
End Sub

Table of Contents

Related product manuals