NiamhB
Technical User
- Mar 14, 2013
- 2
Hi,
I have a project that sends 4 bytes of data via RS232 to the Serial Port on the computer.
I want to store the values coming in into specific registers. When I receive the decimal value 230 (binary 11100110) I want to store the next two bytes as X and then Y so that I can use this information further.
I can display the data on MSComm in a text box repeatedly but I don't know how to store the X and Y values.
I want to use the X and Y values coming in so that I can double integrate them and relate the relative displacement to the displacement of the mouse pointer.
What I have so far is:
Private Sub MSComm1_OnComm()
Dim sData As String
Dim ID As Long
Dim X As Long
Dim Y As Long
Dim Z As Long
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
If (Buffer) = 230 Then
ID = Asc(sData)
End Select
End Sub
I don't know how to store the next two bytes in an X and Y Byte
Can anyone help me out please?
I have a project that sends 4 bytes of data via RS232 to the Serial Port on the computer.
I want to store the values coming in into specific registers. When I receive the decimal value 230 (binary 11100110) I want to store the next two bytes as X and then Y so that I can use this information further.
I can display the data on MSComm in a text box repeatedly but I don't know how to store the X and Y values.
I want to use the X and Y values coming in so that I can double integrate them and relate the relative displacement to the displacement of the mouse pointer.
What I have so far is:
Private Sub MSComm1_OnComm()
Dim sData As String
Dim ID As Long
Dim X As Long
Dim Y As Long
Dim Z As Long
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
If (Buffer) = 230 Then
ID = Asc(sData)
End Select
End Sub
I don't know how to store the next two bytes in an X and Y Byte
Can anyone help me out please?