02-24-2020 02:20 PM
Hi,
I currently use USB A to B cable to communicate to my electronic load and power supply. I would like to know the depth of the buffer so I can read messages only when there is a message in the buffer. I tried to use the Serial Bytes at Port property node, but it outputs Error: -1073807331 (The specified attribute is not defined or supported by the referenced resource).
The real problem at hand is that I need to clear the buffer during operation to avoid any buffer overrun that may occur. The shipped equipment's LabVIEW drivers writes a single message and expects a single reply. There is no handling/parsing of unexpected extra messages the equipment may send. I would like to avoid a buffer over run error.
I was thinking that every time I run their LabVIEW driver I could clear the buffer of any extra messages left over. To clear the buffer should I read until there is no messages left, should I disconnect then reconnect the VISA session to clear the buffer, or use an entirely different approach?
This is for work so I do not think I can post the code, but any advice helps!
Regards,
Ryan Lehman
Regards,
Ryan Lehman
02-24-2020 02:43 PM - edited 02-24-2020 02:44 PM
First off what is the device? Does it install a "virtual serial port"?
I am not sure what you are so worried about clearing the buffer. With all of the instruments I have used over the years, I can not recall any instrument that ever required clearing the VISA Serial buffer for any reason... and every time I thought "stale data in the buffer" was causing the issue, I was wrong.
But without knowing any more specifics all I can give is some general advice about VISA and serial ports
02-24-2020 03:32 PM
The device that I was worried about is the IT8500 electronic load. The drivers are here: http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=DA7159442ABC3F6FE0440021287E6E....
I do not think it installs a virtual serial port. I have a USB to serial driver installed on my computer, but it still shows up as a COM port.
I was worried about the buffer because I have ran into the VISA error: -1073807252. The cause I have yet to debug, but you are correct it is much more likely that I have made a mistake than the equipment.
Thank you for the help,
1). I will take out these from my code
2). I am using termination, so I don't think any problem here but I will double check.
3). I will try to integrate it into my code
1). The LabVIEW driver I downloaded has it set to 26. I will increase it.
2). Right now it is set to 10 seconds, which I believe will work.
02-24-2020 08:48 PM
Most people "who understand VISA" set the VISA Read to be 1000 bytes. I, myself, prefer 1024 ...
Bob Schor
02-25-2020 06:20 AM
@Bob_Schor wrote:
Most people "who understand VISA" set the VISA Read to be 1000 bytes. I, myself, prefer 1024 ...
It just has to be more than a message will be to guarantee the read is stopped by the termination character. I tend to use 50 most instruments. If making a generic driver, I would probably just go with the 4096.
02-26-2020 03:02 AM
@RyanLehman wrote:
I do not think it installs a virtual serial port. I have a USB to serial driver installed on my computer, but it still shows up as a COM port.
Just in case anyone else ends up scratching their head trying to understand this sentence. If your USB device shows up as a COM port, it is functioning as a virtual serial port. So to translate the sentence above:
I do not think it installs a virtual serial port. I have installed a virtual serial port driver, but it still shows up as a virtual serial port.
Here's a link to start reading (The rabbit hole is very very deep, so beware)
02-26-2020 10:09 AM - edited 02-26-2020 10:12 AM
Hi all,
I have made the following changes.
Maybe I have set the termination character incorrectly, any other things I can do to check/verify? I have attached the two NI I/O Trace files, which might not be helpful info, but can't hurt.
Regards,
Ryan Lehman