Owner manual
3-18
<Toc> <Ind> <3. PC Link Communication >
IM 77J01J11-01E
'Initialize label control that displays character strings sent and received
Label1.Caption = ""
Label2.Caption = ""
End Sub
--------------------------------------------------------------------------------
'This processing starts each time 1 byte is received
Private Sub MSComm1_OnComm()
Dim strBuf0 As String
Select Case MSComm1.CommEvent
Case comEvReceive
strBuf0 = MSComm1.Input '
Select Case strBuf0 'Case classification based on 1 byte received
Case Chr(2) 'When it is stx
strBuf1 = "[stx]"
Case Chr(3) 'When it is etx
strBuf1 = strBuf1 & "[etx]"
Case Chr(13) 'When it is cr
strBuf1 = strBuf1 & "[cr]"
'This is provided as a measure against the fact that a command sent may
'be seen as response depending on a combination with communication
'converter.
If strBuf1 = Label1.Caption Then
strBuf1 = ""
Else
strReceive = strBuf1 'Completion of character string received
fSend = False 'When it is not stx, etx, or cr
End If
Case Else 'stx,etx,crÇ≈ǻǢÇ∆Ç´
strBuf1 = strBuf1 & strBuf0
End Select
Case Else
End Select
End Sub
--------------------------------------------------------------------------------
'Timeout
Private Sub Timer1_Timer()
3rd Edition : Oct. 15, 2007-00