05-05-2009 12:08 PM
The wording of the Basic Serial Write and Read (LV 8.5) vi is very misleading. Here is the exact text:
"Select the serial resource and the operations (Read, Write, or both) to be performed. If both are selected, the VI will write the data first, read data and then close the VISA session that is opened to the port. This VI will wait until the specified number of bytes is received at the port. Only the number of bytes specified will be read."
First of all the number of bytes read is an indicator and not a control. You cannot specify this number. The description sounds like this needs set before you run anything. The other issue is the delay before read control. It should say something to the effect of "delay before data is displayed". Delay before read sounds like a value you would want set to zero or as small as possible. Sorry for the gripe but compared with all the other examples this one is horrible.
Adam
05-05-2009 01:03 PM
I believe the number of bytes to read was a control in an earlier version. This probably did not have the VISA Bytes at Serial Port so yes, the message should be changed.
I actually think the Delay Before Read is a very accurate description. The purpose is to give the instrument time to finish writing it's message before the VISA Bytes at Serial Port executes and determines how many bytes should be read. The delay should be set as close to 0 as possible.
There are actually several different ways to make the VI better. If the instrument returns a termination character and since the VISA Configure Serial Port is set for term character enabled, you can eliminate the VISA Bytes at Serial Port and just specify some arbitrary number of bytes to read. The VISA Read will automatically terminate when the term character is detected. You could also eliminate the fixed delay and use the VISA Bytes at Serial Port in a loop. Exit the loop when the number of bytes is greater than 0. There would be another loop with a VISA Bytes at Serial Port and a VISA Read. Keep reading until the number of available bytes is 0.