04-05-2020 05:13 AM
Hi all,
I have a question about a Serial control RS232 protocol.
First of all, I want to emphasise that I read this information packages from a device that I cannot change, so I can unfortunately not introduce proper ID bytes.
This device can sent 5 different information packages.
I will not go into detail of the first 2, because they have ID bytes (0x00 and 0x01), so this is no problem.
The remaining 3 packages only have a starting byte (0XFF), and contain the following information:
So far so good. With this information I'am able to read all data I need. However, there is one last package, which is a sort of control. It starts with 0xFF and sents than 4 data bytes, and i should check whether byte 1 and 3, and byte 2 and 4 are equal.
This all happens in the following sequence: 3 - 5 - 3 - 5 ….. (until packet 3 is sent 10 times) - 4 - 5. And then the cycle repeats again.
My question is: How can I implement the fifth package? I see 2 acceptable options myself, either using the known sequence or using the fact that package 5 is the only package which is a total of 5 bytes. But I have no clue how I can implement this.
Hopefully someone can help me.
Thanks in advance.
10-20-2020 10:24 AM
Hello Bryan_1995,
Maybe I don't get your question right but if you have straight sequence then you can implement simple state machine.
10-20-2020 02:25 PM - edited 10-20-2020 02:34 PM
Here's an example: The fifth byte this device sends is the "ID Byte" this is my sub-vi for decoding.
Notice there is a case for every ID byte and a default case that does nothing for ID's I don't care about or bad ID data.