LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can VISA Read read more than 4096 bytes?

Hi.
Can VISA Read read more than 4096 bytes? I need to read
65 Kbytes of characters but VISA Read can only read
4096 bytes. This does not matter how much I set the
timeout or the amount of bytes at buffer. I used the
VISA Set Buffer Size vi. Can anyone help?

Thanks,
Van
0 Kudos
Message 1 of 6
(3,597 Views)
Hi Van,

If you have a termination character enabled, then the VISA read will always return after receiving this character, regardless of whether you ask for 4 or 400 bytes.

Maybe this is your problem? If you haven't disabled this function explicitly, it might be active. I have had problems turning this off in certain VISA versions however.

By the way, the VISA Set buffer size is used for allocating space for data not yet read by VISA, not for each read. Setting this value high will make sure you don't "lose" data, but won't affect the amount of data transferred at each read.

Let me know how you get on

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 6
(3,597 Views)
Van:

What value were you setting in VISA Set Buffer Size? And make sure to use the correct mask - in this case I think you want to set the I/O receive buffer, which is mode 16.

As far as the buffer size goes, it is dependent on the underlying Serial driver. For most serial drivers, the default is 4KB but it can be adjusted somewhat. I've seen a request of 32KB work on most systems. I've also seen errors when you request 64KB, so you may want to try some intermediate values. Unfortunately in the error case, the underlying Serial driver doesn't always return an error, even if it doesn't support that buffer size, so there's no way for VISA to return an error. What kind of Serial port do you have? I've seen some USB-Serial adapters that don't sup
port modifying the receive buffer size, for example.

Also, when using VISA on Unix platforms (including Mac OS X) there is no way at all to set the underlying Serial buffer size because there isn't a POSIX API to do so. In these cases, you must use some type of flow control to ensure there is no data loss.

But as long as the underlying Serial driver doesn't lose the data, NI-VISA has no limit on the amount it can read. We routinely do benchmark tests with up to 32KB to ensure proper data transmission.

Dan Mondrik
National Instruments
Message 3 of 6
(3,597 Views)
Thanks Shane.

I got enough buffer now.
I placed the vi at the wrong place.
I needed to place it way before I
read the data.

Thanks,
Van
0 Kudos
Message 4 of 6
(3,597 Views)
Thanks Dan,

I got it to work now.
I had to put the buffer size vi way in
front of my read vi.

Is there a way of monitoring the
incoming serial data as it come in?
Right now I'm just reading after everything is
in the buffer.

Thanks,
Van
0 Kudos
Message 5 of 6
(3,597 Views)

NI Spy monitors the data

0 Kudos
Message 6 of 6
(2,856 Views)