LabVIEW Channel Wires

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting data on consumer loop between producer gaps of sending data using channel wires

Solved!
Go to solution

Hello,

I'm going to state my issue in brief way. I receive data from Serial port by trapping number of characters ended with termination character. I expect 6 values arriving at different time intervals. I then transfer those 6 parameters using channel wires to another consumer loop for computation. So the producer loop sends data at different time intervals (upon data arrival).

 

My problem comes when I want to plot constant value on a chart (like zeros) until I receive incoming data. As I mentioned, I can not move plot to Producer loop as it will wait (hangs) for reception of incoming data at any time and won't move from current iteration until termination character is received.

 

So, just to simplify the issue, I created a simple example with no serial data reception which a sine is sent every 5 seconds while plot on consumer should plot zero every 100 ms until receiving new data. Could channel wires be configured in a way to allow loop of consumer to move on until new data arrives?

 

The difficulty is consumer loop should be faster than producer loop and hence a constant value is plotted until data arrives and sent from producer.

 

KInd regards,
Waleed El-Badry, MSc., CLAD MCPD
0 Kudos
Message 1 of 4
(6,266 Views)
Solution
Accepted by wbadry2

Since you're using a timed loop for the consumer loop you could probably wire a 0 timeout on the channel reader.  Check the valid flag to see if you read any valid data and if not, plot a 0.

Message 2 of 4
(6,237 Views)
Solution
Accepted by wbadry2

Thanks Jeff for your valuable response. I came by your presentation yesterday and applied your pattern. So you saved me twice Smiley LOL 

 

6.png

KInd regards,
Waleed El-Badry, MSc., CLAD MCPD
0 Kudos
Message 3 of 4
(6,233 Views)