01-13-2010 09:11 AM
Hello,
I want to decode a message from a blackbox but i don't know how to configure my RS232 Input module.
I copy the supplier informations about this message :
| Channel Number | 8 |
|---|---|
| Total Length | 6 bytes |
| Channel | Data1 | Data2 | Data3 | Data4 | Checksum |
|---|
Lateral = Data1 And 0x7F + Data2 / 0x100
If (Data1 And 0x80)=0 Then Lateral = -Lateral
Longitudinal = Data3 And &H7F + Data4 / 0x100
If (Data3 And &H80)=0 Then Longitudinal = -Longitudinal
At the end i want to read Lateral and Longitudinal informations.
Can someone help me ?
Thanks a lot
Hugus
01-13-2010 09:46 AM
If one of the standard rS232 formats will not work, then read the 6 bytes as six channels, where the data format for each channel is b.
then, you can use the Bit arithmetic and bit mask modules, in combination with the Formula to do the math.
01-22-2010 10:46 AM
Hello,
Thanks CJ !
My problem is that i have near 20 different messages, and the Message ID is written in the first Byte
So I have to read a Byte, compare it to my Message ID and after take x Bytes (not the same for all messages), verify the checksum to validate the message and then do my calcul on y bytes. Abd this for all my messages.
In ascii, i can configure the module to skip or find a special character but in Byte mode, no !
I test to read the bytes with my RS232 input module but how can i scan byte/byte to search my Message ID ?
Thanks to help me
Good day
Hugus