NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Active Participant
jyang72211
Posts: 1,436
Accepted Solution

visa read byte at port

On my VISA read, I feed in the bytes at port property node as input for how many bytes to read (it is 4 byte).  However, the output of the visa read only give out 2 byte.  It seesm like some bytes were lost during the read operation?  Why is that?  It there an easy to see what is in the buffer of the serial port?  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Knight of NI
Posts: 18,064

Re: visa read byte at port

You probable have the VISA session configured to end reads when it sees a termination character, and the VISA Read is seeing the termination character, and ending the read, regardless of how many bytes you told it to read. If you want it to explicitly read that many then you need to turn off the "Enable termination character" option in VISA Configure Serial Port.

Active Participant
jyang72211
Posts: 1,436
0 Kudos

Re: visa read byte at port

Hi Smercurio,

 

That fixed my problem.  Sweet!!!!  Before I use the VISA Configture Serial Port function, I tried to just use a property node to change termination character enable to false for the VISA, but that didn't work.  Why is that?  This change in the program is termporary, right?  So I need to make sure I change the option before I start all my program, correct?  If I change that in MAX, would I be changing it permanantly?  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Knight of NI
RavensFan
Posts: 15,961

Re: visa read byte at port

[ Edited ]

Configure Serial Port VI does configure the termination character.  So if you tried to do something with it before then ran that VI, you may have just undone whatever you just did.

 

With nothing wired into those connectors of the VISA configure Serial port, the defaults are to enable the termination character and set it to the line feed character.

Knight of NI
Posts: 18,064

Re: visa read byte at port

 


jyang72211 wrote:

Hi Smercurio,

 

That fixed my problem.  Sweet!!!!  Before I use the VISA Configture Serial Port function, I tried to just use a property node to change termination character enable to false for the VISA, but that didn't work.  Why is that?  This change in the program is termporary, right?  So I need to make sure I change the option before I start all my program, correct?  If I change that in MAX, would I be changing it permanantly?  Thanks!


 

Any property change is in place for as long as the VISA session is active. As Ravens Fan noted, VISA Configure Serial Port sets the termination character and enables/disables its operation. Not to sound too obvious, but please look at the documentation for the VIs you intend to use to see what they actually do.

 

As for MAX, that would have no bearing on it.