LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indicators change too fast

Solved!
Go to solution

The numeric indicator changes from a number to 0 too fast for me to see. Is there a way I can store all the numbers?  Thanks

0 Kudos
Message 1 of 6
(1,536 Views)

Be more specific, what is your program doing? Do you need to see all the values or just the non-zero ones?

 

Did you try using a chart? This displays all data.

Or an array? Or write values to a file?

If it just needs slowing down, use a wait function in the loop? (may not be appropriate depending on your functionality.

 

Many other ways to do it if you have more information. Maybe upload your VI.

Ian
LabVIEW since 2012
0 Kudos
Message 2 of 6
(1,527 Views)

I am trying to read in serial from an arduino, but I cannot tell if it is receiving properly. Attached is my Vi.

0 Kudos
Message 3 of 6
(1,520 Views)

I expect the "Bytes at port" needs to be moved inside the while loop (but still before the case structure)? At the moment it only gets read at the beginning and your bottom loop will forever be reading the true case and overwriting the indicators.

 

Did you start from some example code? What is the expected flow of execution?

 

If you are just quick debugging, consider wiring the string to the edge of the while loop, set the tunnel to indexing, and make an array indicator. This will show you all the strings that have come in (though only after you press stop). Or log to a file. Or maintain the array in the loop.

 

Another thing you can do is use NI IO Trace (separate program that should have installed). You can use this to monitor the VISA activity. Open it, press the green arrow, then run your program.

Ian
LabVIEW since 2012
0 Kudos
Message 4 of 6
(1,507 Views)
Solution
Accepted by topic author sw14928

It is obvious that the message is terminated with a Line Feed (0xA).  The serial port is already set up to use that.  The VISA Read will stop its read when 1) the number of bytes you told it have been read OR 2) the termination character is read.  So if you set the number of bytes to read higher than the number of bytes you expect to ever come in a message, the read will stop with the termination character.  This ensures you got a complete message.

 

So since you are seeing if a message has even started, you need to move the Bytes At Port inside of the loop.  Just do no use it to tell the VISA Read how many bytes to read.

 

Other notes:

You can get rid of the local variables for the stop button.  You should have your producer loop (the VISA Read loop) send a message to the consumer to tell it when it has stopped.  The consumer can then stop itself.  You can also set the button's mechanical action back to Latch When Released.

 

You really should not be using the Queue Status.  Just let the Dequeue Element sleep while it is waiting for data to come in.


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 6
(1,471 Views)

Thank you IanSh and CrossRulez, a combination of your solutions has solved the problem. I needed bytes at port inside the while loop and to manually set the visaread bytes.

0 Kudos
Message 6 of 6
(1,457 Views)