
60
Communication Event Processing
Static Sub Comm1_OnComm ()
Static LineBuf$
While Comm1.InBufferCount
Msg$ = Comm1.Input ' Get Comm input character
CharIn$ = Msg$
If Msg$ = Chr$(13) Then Msg$ = "" ' Remove CR
If Msg$ = Chr$(10) Then Msg$ = "" ' Remove LF
If Msg$ = "*" Then
' if i2cStick Ready
Msg$ = "****"
‘ Substitute Token
CharIn$ = Chr$(13)
‘ Terminate Line
End If
LineBuf$ = LineBuf$ + Msg$
'Add new text to line buffer
If CharIn$ = Chr$(13) Then
' if Carriage Return detected
iPortResp$ = Left$(LineBuf$, 4)
'Isolate Response Code
' Test for i2cStick Synchronous Interface Events
If (StrComp(iPortResp$, "/OCC") = 0) Then
' Open Connection Complete Processing
TextBox.Text = "/OCC Open Connection Complete"
ElseIf (StrComp(iPortResp$, "/MTC") = 0) Then
' Master Transmit Complete Processing
TextBox.Text = "/MTC Master Tx Complete"
ElseIf (StrComp(iPortResp$, "/MRC") = 0) Then
' Master Rx Complete Processing
TextBox.Text = LineBuf$ 'Update Display
ElseIf (StrComp(iPortResp$, "/STC") = 0) Then
' Slave Tx Complete Processing
TextBox.Text = "/STC Slave Tx Complete"
ElseIf (StrComp(iPortResp$, "/CCC") = 0) Then
' Close Connection Complete Processing
TextBox.Text = "/CCC Close Connection Complete "
Содержание i2cStick
Страница 1: ...User s Guide USB to I2 C Bus Host Adapter with iPort Utility Pack Software www mcc us com...
Страница 9: ......
Страница 10: ...1 Part 1 i2cStick USB to I2 C Bus Host Adapter Part 1 USB to I2 C Bus Host Adapter User s Guide Model MIIC 207...
Страница 20: ...11 Part 2 iPort Utility Pack for Windows Part 2 iPort Utility Pack for Windows...
Страница 21: ...12...
Страница 47: ...38...
Страница 48: ...39 Part 3 i2cStick Programmer s Reference Part 3 Programmer s Reference ASCII Command Interface Definitions...