
-66-
’ >>>>> Read timing mark count <<<<<
MSComm1.Output = Chr(&H5) + "T" + Chr(&HD) ’ Send timing mark count read command.
Do ’ Wait until timing mark count is received.
DoEvents
Loop Until MSComm1.InBufferCount = 3
TMCount = MSComm1.Input
’ Receive timing mark count.
Text1.Text = "Timing mark count : " + TMCount + Chr(&HD) + Chr(&HA)
’ Display timing mark count.
’ >>>>> Read C mode (read fixed length data) <<<<<
MSComm1.Output = Chr(&H10) + "C001" + TMCount + Chr(&HD)
’ Send C mode read command.
Do ’ Wait until C mode data is received.
DoEvents
Loop Unti1 MSComm1.InBufferCount = 3* Val(TMCount) ’ Keep looping until "3 * timing mark
count" is received
’ since one column corresponds to 3 bytes.
CMode = MSComm1.Input ’ Receive C mode data.
Text1.Text = Text1.Text + "C Mode : " + CMode + Chr(&HD) + Chr(&HA)
’ Display C mode data.
’ >>>>> Read E mode (read variable length data) <<<<<
ReDim EMode(Val(TMCount)) As String ’ Secure area.
Dim DataLength As Integer
Text1.Text = Text1.Text + "E Mode : " + Chr(&HD) + Chr(&HA)
MSComm1.Output = Chr(&H10) + "E001" + TMCount + Chr(&HD)
’ Send E mode read command.
ReciveCnt = 0
Response = " "
Do ’ Wait until E mode data is received.
DoEvents
Response = Response + MSComm1.Input ’ Receive E mode data.
DataLength = InStr(Response, Chr(&HD)) ’ Extract received data for each column.
If DataLength <> 0 Then
EMode(ReciveCnt) = Left(Response, DataLength)
Text1.Text =Text1.Text+Format(ReciveCnt+1,"000")+"-Column:"+EMode(ReciveCnt)+Chr
(&HA)
Response = Mid(Response, DataLength + 1)
ReciveCnt = ReciveCnt + 1
End If
Loop Until ReciveCnt = Val(TMCount)
Screen.MousePointer = 0 ’ Initialize mouse pointer.
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False ’ Close communication line.
End ’ Finish program.
End Sub
13.Appendix
Comentários a estes Manuais