12-19-2016 08:35 AM - edited 12-19-2016 08:36 AM
Hi,
I'm trying to implement reading from multiple COM Ports. I attached the basic idea of the Project. Unfortunatly the Data in the Consumer Loop is somehow corrupted. Am i getting something wrong with the Queue concept? Otherwise i have to lock in the SubVI if there's a error, but I think i'm getting something wrong with the Queue, because if there's just one device selected everything works just fine.
Thanks in advance for your help
mark
12-19-2016 09:22 AM
Where to begin...
1) No need for the sequence structure in your initialization loop.
2) I see no reason to use the Queue name either.
3) In general, the Bytes At Port is not what you want to use. Since you have the termination character turned off, I am left to assume your devices are sending data in a binary format (not ASCII). Do you know how long each of your messages is? How do you know you got a full message and not parts of several messages?
4) You are reading all of the ports and sending them to the consumer loop, and when a second has passed repeat. But the way you have the consumer set up, you wil only see the data from the last port.
5) In general, the Timed Loop causes interesting issues on a Windows machine. Change that to a normal While loop and use a Wait (ms) to time your loop.
As far as your "corruption", I suspect the issue is in how you are reading the serial port.
12-19-2016 09:44 AM
Why are you using a timed loop?
What exactly are you reading from? An instrument? Something you designed?
You are over complicating it from the very beginning.
12-20-2016 01:11 AM
@crossrulz wrote:
Where to begin...
1) No need for the sequence structure in your initialization loop.
2) I see no reason to use the Queue name either.
3) In general, the Bytes At Port is not what you want to use. Since you have the termination character turned off, I am left to assume your devices are sending data in a binary format (not ASCII). Do you know how long each of your messages is? How do you know you got a full message and not parts of several messages?
4) You are reading all of the ports and sending them to the consumer loop, and when a second has passed repeat. But the way you have the consumer set up, you wil only see the data from the last port.
5) In general, the Timed Loop causes interesting issues on a Windows machine. Change that to a normal While loop and use a Wait (ms) to time your loop.
As far as your "corruption", I suspect the issue is in how you are reading the serial port.
Hi crossrulz,
I deleted the Queue name and replaced the timed loop with a while loop. I'm reading messages from a µC and they vary in length (binary fromat). In the Test VI I'm doing error handling if something is wrong or not recieved. So I assume something is wrong with the Queue, because there're no errors when reading the messages, but when I show them in the indicator.
12-20-2016 06:02 AM
mark_wer wrote: So I assume something is wrong with the Queue, because there're no errors when reading the messages, but when I show them in the indicator.
Ok, let's explore this a little more. What exactly is the "error" you are seeing?