From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple COM Port/Queue

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

0 Kudos
Message 1 of 5
(2,861 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,840 Views)

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.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(2,830 Views)

@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.

0 Kudos
Message 4 of 5
(2,788 Views)

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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(2,769 Views)