07-18-2013 03:54 PM - edited 07-18-2013 03:57 PM
Hi, everybody.
I'm not at all versed in arrays in LabVIEW and have been scratching my head for a while on this. I expect it should be an easy solution, however.
Posted in the picture below is a portion of the program I'm writing which is using VISA to communicate with a serial device. Near the bottom-right I am attempting to take the string response from VISA Read, convert it to a float number format, and then feed it into an array by appending it with the "Insert Into Array" VI for each iteration of the while loop and each VISA Read.
My issue is that I realize this VI requires an input array and an output array, whereas I am only providing the output array. The only task I am trying to accomplish is to store the data of the repeated outputs of VISA Read per each iteration of the while loop into an array for a future graph. Do you have any tips for how I should go about doing this?
Thank you very much.
Edit: To fix the image not posting
07-18-2013 04:22 PM - edited 07-18-2013 04:28 PM
Hi Oliver,
use a shift register (SR) to store your array. SRs are placed at loop borders...
- Your timing in the sequence is flawed: it will run in parallel with the rest of the code and so will hurt your serial port reading. Create a sequence frame in front of the existing one, and put the wait inside there. Waiting for "multpiple" isn't the perfect function here either...
- Usually you don't need BytesAtPort as either you wait for a TermChar (as configured by InitSerialPort) or a certain number of bytes. Then you also don't need an additional wait function.
- When your loops runs for a pre-determined number of iterations you should use a FOR loop instead of a while loop.
- Loop counters should be integers. There's a "-1" function available, too...
- You can put the CR/LF char directly into the string constants. No need to build up strings like you do... Read the help on "string formatting"!
07-18-2013 04:29 PM
07-19-2017 11:01 AM
Use a concatenated string then connect it to a shift register of a loop which is inside an event structure as shown below. Play with it and you will have an idea on how to use that concept in your intended program.