Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Port Read Problems

I am getting conflicting results from the VISA read driver for an RS232 COM port.
The device that I am monitoring is 38400 Baud , 8 data bits , Odd Parity .
 
The COM port settings are also set accordingly.
 
I first read the number of bytes available , then use this number as the number of bytes to read.
The output field for bytes read, in the VISA read driver , usually matches the input field for number of
bytes to retrieve. However , often the VISA driver reads less bytes then what is requested.
 
For example :  The number of bytes available = 75 ->  I request to read 75 ->  The VISA reads only 8 bytes.  
 
Also, once I noticed that the VISA read driver actually read more bytes then requested:
 
The number of bytes available = 146 ->  I request to read 146 ->  The VISA reads 152 bytes!
 
I am runnning LV 7.0 on a Win 2K system.
 
Any ideas on what could cause this discrepancy? Could  FIFO overload in the UART be causing this?
 
 
   
0 Kudos
Message 1 of 3
(3,437 Views)
I don't think I've ever seen VISA read more bytes than requested but if you're using the default VISA Configure Serial Port, that could account for reading a lesser count. The default setting is that the termination character is enabled. Wtih it enabled, VISA Read will terminate when the number of bytes is read OR the termination character is detected. The default termination character is 0xA or the linefeed character. If this character is in the receive string, you will terminate the read. Try turning Enable Termination Character to false.
Message 2 of 3
(3,432 Views)
What version of the VISA driver are you using?
Logan S.
0 Kudos
Message 3 of 3
(3,419 Views)