08-01-2012 04:35 AM
I am new to labview and have developed a simple VI for acquiring data from an instruments particular channel via RS232 serial communication. Using VISA READ data is read with handshake mechanism for every 30 secs. With an overnight run for data acquiring it was observed that data acquisition stops after few hours (0 is written thereafter).
Same procedure was repeated with a code written in VB6.0 and there was no distruption in data acquiring for almost 15-16 hrs.
Please find the VI attached. Could you please suggest someway to over come this problem, or if there is any configuration missing while defining VISA?
08-01-2012 07:05 AM
1. Why have the outer case structure? Get rid of that.
2. If you are using the Termination Character, you do not need the Bytes at Port. Just wire some very large number into the VISA Read function.
3. Don't close out the port with each read. Close the port outside of the while loop.
4. Use shift regisers for the error clusters to so that errors are not lost. You are probably getting an error, but not catching it.
5. There's not point in hiding so many of your controls. Just make them constants on the block diagram.
6. Try to keep wires flowing from left to right. It'll make it a lot easier to read the code.
7. Do not use a property node to read a value when a wire is easily available.
8. Why convert the read value to a number and then back into a string? Why not just use the raw string?
Here's a snippet of how I cleaned up the code. Hopefully it'll help.
08-01-2012 09:42 AM
A couple of tweaks. If you want to read every 30 seconds, the wait should not be sequential after the write. Just place it by itself inside the loop. If the instrument really needs 30 seconds to respond after the write, I would change the default timeout value and get rid of the wait completely. Since the read will stop on receiving the termination character or when the timeout is reached, you don't need a fixed wait.