
-65-
’ >>>>> Check device communication <<<<<
If MSComm1.DSRHolding = False Then ’ Check communication.
MsgBox "The device is not turned on"+ Chr(&HD) + _
"or no communication cable is connected. !!", 16, "SR-430 Sample Program-1"
Screen.MousePointer = 0
Exit Sub
End If
If MSComm1.CTSHolding = False Then
’ Check device communication state.
MsgBox "The device is not in the receivable state. !!", 16, "SR-430 Sample Program-1"
Screen.MousePointer = 0
Exit Sub
End If
’ >>>>> Initialize <<<<<
MSComm1.Output = Chr(&H18) + Chr(&HD) ’ Send initialize command.
Do ’ Wait until 1 byte is received.
DoEvents
Loop Until MSComm1.InBufferCount = 1
Response = MSComm1.Input ’ Receive initialize response.
If Response <> Chr(&H6) Then
MsgBox "Initialization fails !!"
Screen.MousePointer = 0
Exit Sub
End If
MSComm1.Output = Chr(&H13) + "12" + Chr(&HD) ’ Send read line specify command (12 lines.)
MSComm1.Output = Chr(&H10) + "T" + Chr(&HD) ’ Send timing format specify command
(direct-under type).
MSComm1.Output = Chr(&H2) + "2" + Chr(&HD)
’ >>>>> Read card <<<<<
MSComm1.Output = "?" + Chr(&HD) ’ Send card read command.
ReciveCnt = 1 ’ Set number of bytes of read status to re
ceive.
Do ’ Wait until read status is received.
DoEvents
Loop Until MSComm1.InBufferCount = ReciveCnt
Response = MSComm1.Input ’ Receive read status.
If Response <> "0" Then ’ Check read status.
MsgBox "Error occurs!!" + Chr(&HD) ±
"Read status = " + Response
Screen.MousePointer = 0
Exit Sub
End If
13.Appendix
Kommentare zu diesen Handbüchern