LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication : Buffer overflow error

I input a command (ex: *TST?) in labVIEW and run the serial communication VI example. The output after a clean run should be '0'. But, it says that there is some kind of buffer overflow. My bytes to read is set to 4. I change this to many different numbers, and i still get the same error. Now, if i change this byte read number to 0, the simulation runs fine, with no error. What does this mean???!

Also, do my labVIEW "baud rate" and device "baud rate" have to be the same? i am new to labVIEW altogether, so i dont even know what baud rate is.

My other guess was that the buffer/register of my device (power meter) might have information in it already, so i tried to clear it by the clear commands using the device's manual, that didnt do anything either.

Also, does it make a difference if the termintion character is ON or OFF under the subVI of "VISA Serial" ? i mean, either way, i get the same buffer overflow error.

Anyway, this is all the stuff i have done and make gotten the same error. After reading this, do you have any other suggestion? i am kinda stumped at this point. Do you think that i shouldnt be even using that example serial comm.VI. Any kind of suggestion that might give me any insight will be greatly appreciated. THANKS!


P.S. I have tried manipulating the Tranfer Buffer size and Recieve Buffer size from the advanced options from the device manager in windows, (i am using Win 2000 Pro.) ... but still i get the over flow!!!
0 Kudos
Message 1 of 4
(4,892 Views)
What's the exact error code that you're getting? I tried to find a VISA error that mentions buffer overflow but couldn't find one so I'm not sure exactly what you're seeing. When you set to the bytes to read to 0, you're telling VISA Read to not get any data from the serial buffer.
 
Yes, the baud rate of the instrument and the setting in LabVIEW must match exactly as do parity, data bits, and flow. These are the serial communication parameters and have nothing to do with LabVIEW. For the sake of discussion right now, you can think of baud rate as the number of bits per second transmitted. It's not really but if you want all of the details, google baud rate and look at some of the explanations of serial communication.
 
The termination character Boolean tells VISA read to terminate or not terminate when the termination character is detected. A termination character is usually a CR, LF, or CR/LF that is appended to the end of the data. Many instruments will do this so that it is easy to detect when the data is complete. When set to True, the VISA read will read either the number of bytes specified or until the termination character is detected. If you specify 4 bytes and the termination character is after the first byte, then you will only read 1 byte. If you disable the termination character, then VISA Read will attempt to read that number. If less bytes are available, then you will get a timeout error waiting for the extra bytes. If more bytes are available, you will only get a partial read. It's usually a good idea to enable the termination character if the instrument provides one. The instrument manual should tell you that and what the character is. Then you can specify an arbritrarily high number of bytes to read and get all of the data with each read. Without a termination character, it's a good idea to use the VISA Bytes at Serial Port after the read to determine how many bytes are actually available and wire that value to the VISA Read.
 
What is the make and model of the meter? Have you tried to see if there's an instrument driver available for it? You could also try using the Instrument I/O Assistant.
0 Kudos
Message 2 of 4
(4,876 Views)

Hi Dennis,

Thanks for your reply. Sorry this is kinda late, but i was working on the meter and didnt get a chance to review the forums. As far as i know, NI doesnt have a driver software for this meter. It is PM 100 from ThroLABS.

As far as that error is concerned, i figured out that the buffer overflow was because the buffer was apparently full, and when i tried to send another command to the buffer of the equipment, i was getting and error of overflow. So i found this real nice VI for serial comm. online which clears the buffers before writing anything into it. SO now i am able to communicate with the power meter and all the commands are working properly.

However, now i am running to trouble for acquiring data. Do  you think that i should use this serial VI i found online as a sub VI in a new VI that i might make to take certain data? I am new to LabVIEW as you might be able to tell. So any help in data acquisition will be helpful. Oh, and here's the link where i got the serial VI from:

http://hannahsmac.magnet.fsu.edu/labview/vi_library.html >>> scroll down to Serial Port Handler and download the 6.1 VI.

Anyway, thank you for your reply, i really do appreciate it. If you can find a driver to this meter (ThorLABS PM 100) please tell me, that might help me in the data acquisition process. Thanks

Haris

0 Kudos
Message 3 of 4
(4,857 Views)
Scott Hannahs is a very accomplished LabVIEW programmer. Using his code as a subVI would make your application much more robust.
0 Kudos
Message 4 of 4
(4,847 Views)