04-10-2021 07:52 AM - edited 04-10-2021 07:59 AM
I'm working on a toy example in which Labview listens to a com port via VISA. An Arduino sends data to the com port at 9600bps.
I can get the VI below to capture most of the data sent by the Arduino, but some of the longer lines are garbled. Wondering why this might be - perhaps something to do with the dynamic array indexing I'm using? Eg, dynamic array allocation is too slow, which leads to the incorrect combination of the first two lines of the message?
FWIW, this seems like a much more flexible way to get sensor data out of an Arduino than the LINX library. It's not hard to imagine the Arduino using I2C, soft serial, etc to get data from GPS, or a set of fancy i2c sensors.
Also, the example for this application (below) uses the feedback node with concatenate strings (and works fine with my arduino data sender). Is string concatenation a cheaper operation memory-wise?
Finally, if this was arduino c++ code, there'd be a line that looks like
if( serial.new_data() == TRUE ) {
parse the message...
}
Is this the purpose of the shift register in carrying the VISA object to the VISA-READ object?
04-10-2021
08:07 PM
- last edited on
05-14-2025
07:06 PM
by
Content Cleaner
Building of arrays will cause issues, as increasing memory allocations will make things slow. So a couple of things I would do:
1. Get rid of the delay in your loop. The VISA Read will limit your loop rate.
2. Process your data as you receive it. I would highly recommend using a Producer/Consumer. The Producer loop reads the data from your Arduino while the Consumer loop processes the data however it needs to (log, write to a chart, etc.) in parallel.