Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial read does not return the correct number of bytes?

I have written a vi using visa that writes a command to the serial port waits for a delay then reads bytes available at port and proceeds to read the bytes. The problem is even though the correct number of bytes are available only a portion of them are read and displayed: as well the number of bytes available at the port continues to increment by the number of unread bytes.I am using Labview 6i, NI PCI 485 4 port serial for my com port: and I am trying to communicate with a DA/M 100 manufactured by Dycor Industies it comunicates Rs485.Thank You Dale Walker dwalker@bclc.com
0 Kudos
Message 1 of 3
(3,115 Views)
Are you certain the count arguement acurately reflects the number of bytes at the port? I might suggest running NI-SPY in the background to log the VISA calls being made. Make sure that:

1) count is sufficiently large
2) a termination character is not included in the data stream
3) the correct flow is being used

Ryan Mosley
0 Kudos
Message 2 of 3
(3,115 Views)
DRW:

Once the serial port driver indicates the number of bytes it has received, they are held internally by the OS driver until the app reads them.

So the most common cause of your problem is that the termchar causes VISA to stop reading. Set the property "ASRL End In" to 0 and this should solve your problem.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 3 of 3
(3,115 Views)