01-30-2014 03:00 PM
Hello,
I'm new to LabView but I have a device that measures position through a serial port and I'd like to continously aquire data for some set amount of time and store that data to a file. I can communicate with the device through the basic serial read and write however I cannot get the program to continuously send a command out to the device and store the response to a file. I have attached what I've done so far.
As I said I'm very new to LabView VIs so any help would be appreciated!
01-30-2014 03:53 PM
You have several problems, but all are easily fixed.
1. You while loop only iterates once then ends, because you have a True wired to the termination terminal. Repalce that True constant with a control on the front panel, probably the Stop button from the Boolean controls palette.
2. You should not be using both termination character enabled and Bytes at Port in the same program. Unfortunately the basic serial example is set up that way without commenting on why it should not be routinely done. If your device sends messages whic end with a termination character, you can simply eliminate the Bytes at Port property node and set the byte count input to a constant value larger than the largest message expected. The VISA Read will wait until the termination character appears and then return all the bytes read. If your device does not send a termination character, then things become more complicated. In any case you MUST know what protocol is used by the device.
3. To accumulate all the data from multiple reads place a shift register on the while loop. Where you have the Concatenate Strings in the Read case, add an input so that the prior string from the shift register has the new data appended. Note that this will eventually run out of memory if the string gets too large.
4. I notice that you have wired True constants to the case structures. If you will never be using the False cases, simply remove the case structures.
Lynn
02-05-2014 12:22 PM
Thank you so much this has been very helpful! My program works correctly now!