From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I know how many characters to read using VISA?

I'm trying to write a driver using Measurement Studio for Visual Studio 2005 and I keep getting timeout errors because I'm asking to read more characters than are in the buffer. The number of characters varies depending on the response. How do I know how many characters to tell it to read?
0 Kudos
Message 1 of 2
(2,892 Views)
Hi deebp,
If you are using the Serial Protocol you can use the VISA Bytes at Serial Port command to read the amount of data at the port.
If you are using another protocol you will need to implement your own strategy.  One method is to always have your first byte of data sent by your device to be a number which represents the number of bytes of data that are coming.


Regards,
John E.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(2,875 Views)