39
Sample program
Private Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
If Not Command5. Enabled Then
Cancel = True
Exit Sub
End If
'Reset 8526 to local at finish of form
If Command1. Enabled Then
Call SendComm ("RESET")
Call SendComm ("KEYLOCK=OFF")
Call SendComm ("REMOTE=OFF")
End If
Call CloseComm
'Close port
End
End Sub
'Start of test
Private Sub Command3_Click ( )
Dim szBuf As String, nSTB As STB8526_ID
StopFlag = False
Command1. Enabled = False
Command2. Enabled = False
Command3. Enabled = False
Command4. Enabled = True
Command5. Enabled = False
'Confirm status before start
If SendComm ("STATUS?", szBuf) = False Then GoTo Exit_Command3_Click:
If ErrorHandler (szBuf) = False Then GoTo Exit_Command3_Click:
szBuf = "&H" & szBuf
If IsNumeric (szBuf) = False Then GoTo Exit_Command3_Click:
nSTB = CLng (szBuf)
If (nSTB And sREADY) = 0 Then
MsgBox "Can not START.", vbCritical
GoTo Exit_Command3_Click:
End If
'RESET command
If SendComm ("RESET", szBuf) = False Then GoTo Exit_Command3_Click:
If ErrorHandler (szBuf) = False Then GoTo Exit_Command3_Click:
'START command
If SendComm ("START", szBuf) = False Then GoTo Exit_Command3_Click:
If ErrorHandler (szBuf) = False Then GoTo Exit_Command3_Click:
Do
DoEvents
sWait 0.5
'weight of 500msec.