07-20-2006 01:52 PM - edited 07-20-2006 01:52 PM
Message Edited by agill on 07-20-2006 11:52 AM
07-20-2006 02:12 PM
I use the VISA Interactive Control tool located in MAX under Tools>NI -VISA to see how many bytes my Visa Read returns. You might need to do some parsing of the data depending on what you want. Most of my reads I use the Fract/Exp String to Number Function.
Brian
07-20-2006 02:14 PM
You do not wire the return count from the VISA Write to the byte count of VISA Read. The return count is just the number of bytes actually and has no releationship to the number of bytes you can expect back. From your user manual, you can get a rough idea of how many bytes to expect but you can safely wire some large number to the byte count without any problems. The VISA Read will automatically terminate when the instrument asserts EOI and that is automatically appended at the end of the message. So, if you specify 1000 bytes to read and the instrument sends 10, all you will get back is 10 bytes. Your only danger is in specifying too low of a byte count.
For the string conversion, I prefer to use Scan From String. Type cast is not appropriate in most cases. Type casting the string '5' to a U8 for example, will not give you the value 5. It will give you decimal 49 which is hex 31 which is the ASCII representation of the character '5'.
07-20-2006 02:15 PM
07-20-2006 02:21 PM - edited 07-20-2006 02:21 PM
Message Edited by Dennis Knutson on 07-20-2006 01:23 PM
07-20-2006 03:22 PM
Oh, thanks for your help again, Dennis.
I didn't realize you can safely wire a large amount to the Visa READ terminal. That makes things a lot easier for functionality testing. Thanks a lot! 🙂
07-20-2006 04:09 PM
Another useful VISA property node is the Number of Bytes at Port.
http://zone.ni.com/reference/en-XX/help/371361A-01/lvinstio/visa_bytes_at_serial_port/
07-20-2006 04:18 PM - edited 07-20-2006 04:18 PM
Message Edited by agill on 07-20-2006 02:19 PM
07-21-2006 07:46 PM
07-21-2006 10:28 PM