Instruction Manual

<Toc> <Ind> <3. PC Link Communication >
3-23
IM 77J04J11-01E 1st Edition : 2006.08.25-00
'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 'Receiving is regarded as being ended
End If
Case Else 'When it is not stx, etx, or cr
strBuf1 = strBuf1 & strBuf0
End Select
Case Else
End Select
End Sub
--------------------------------------------------------------------------------
'Timeout
Private Sub Timer1_Timer()