12-01-2014 10:52 AM
I have a program that needs to continuously read the serial port. The messages that are sent can be 41, 8, or 4 bytes in length.
I am using the VISA Wait on Event function. Is this the way to go about this? We cannot use a termination character because it can be actual data that is being sent. I read the serial port when there are 4 or bytes.
12-01-2014 11:11 AM
I've never used the VISA Wait on Event. If dealing with binary data over the serial port, just use the Bytes At Port and read that many bytes. I typically through in some sort of wait in there to keep the loop from dominating.
Do you have a good protocol of what the messages look like? When dealing with binary data, there is typically a sync byte that you should look for and then a message ID of some sort so that you know how many bytes are in your current message. This can be done with multiple reads or just concatinating strings and search/split string.
12-01-2014 02:44 PM
You're right. I am probably overthinking this.