Showing results for 
Search instead for 
Did you mean: 

VISA Read Return Count does not match Byte Count

Go to solution

I'm encountering an error with a VISA Read.  I request 8 bytes (Byte Count in), but get only 7 back (Return Count), which causes errors in my downstream code.  The VISA Read block oddly enough does not return an error.  Any ideas on how to debug this?



LabVIEW RT 8.2

VISA 4.3

NI Serial 3.3.0

PXI 8431/4

Settings: 1843200 Baud, 8N1.



0 Kudos
Message 1 of 9
Accepted by mysterj

Is the VISA Read set to end on the receipt of a termination character?  I think it does not put the termination character in the output string, so that might make your Return Count short.



Message 2 of 9
That was the problem.  Thanks for your help!
0 Kudos
Message 3 of 9

How can we set visa read to the end of receipt of the termination character. I'm a beginner. Kindly help. 

0 Kudos
Message 4 of 9

@KarthikMurali wrote:

How can we set visa read to the end of receipt of the termination character. I'm a beginner. Kindly help. 

The VISA Configure Serial Port has a couple of inputs on the top of it to enable the termination character and what the termination character is.  After that, you just tell VISA Read to read more bytes than you ever expect to be in a message and it will stop when that termination character is read.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 9

I tried this put my visa configure serial port gets timeout. Kindly let me know of an other solution to this.

0 Kudos
Message 6 of 9

Kindly post some details.  Such as a VI that has the problem.  Some information on the command you write to the device, and the data that you have received from the device, and what additional data you are expecting that is coming up short.


We can't offer a solution to a problem that is very vaguely described.

0 Kudos
Message 7 of 9

I am using an RS232 cable and serial port to communicate with Nanotec C5 motion controller. I am trying to achieve axis movement with the vi.

0 Kudos
Message 8 of 9

That's missing a bunch of VI's that have VISA functions within them.  I don't see where you tried to use Serial Configuration, I only see a VISA Open.

Also, you didn't mention what data you got vs. what data you expected to see.


Since it seems that he communication is binary, I'm think only using VISA Open as left the termination character set as enabled, and you are getting a byte of value 10 as part of the ordinary within your data stream.  That is the default termination character and would thus stop the VISA Read at that byte whenever it sees it.


I'm also concerned how you split the VISA wire so it is being handled in two different loops.  It makes me wonder if you the communication in the two loops are interfering with each other.


Here's programming tip.  Index Array is expandable.  Drag the bottom border downwards and you will get multiple outputs.  You may not even need to wire any constants as they will automatically give you index 0, 1, 2, 3, ......  That way you don't have to drop multiple copies of Index Array nor split your array wire.

Message 9 of 9