LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Comms Works in NI Max But not In LabVIEW

Hey Guys! I've got a program that is supposed to send a *IDN?\n to a com port to get a response. I know that the hardware is working because it responds in NI max 

NiMaxWorks.PNG 

However, When I do the same in LabVIEW I get a timeout error:

LabVIEWBad.PNG

 

My code is here and everything is zipped below:

VI Snippit.png

 

My question is, the message I'm sending to the board seems identical, however my read is not getting any response in LabVIEW while it's working just fine in Ni Max.

 

Any suggestions would be appreciated. 

0 Kudos
Message 1 of 5
(3,726 Views)

1. For your string constants, go to Visible->Display Style.  Make sure that is turned on.  It makes things easier to debug.  My first thought was that you had it in normal display, which means you would not be sending the same thing.  But you actually do have the \ Codes turned on.

 

2. Try removing the VISA Open.  It might be resetting some of your settings that you just configured.

 

3. Another experiment to try if (2) does not work is set the number of bytes to read to 1.  This will just verify that you can read something.



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 2 of 5
(3,709 Views)

@crossrulz wrote:

1. For your string constants, go to Visible->Display Style.  Make sure that is turned on.  It makes things easier to debug.  My first thought was that you had it in normal display, which means you would not be sending the same thing.  But you actually do have the \ Codes turned on.

 


Done! Believe me, I've wished that was the problem for a few hours now.

 

 


2. Try removing the VISA Open.  It might be resetting some of your settings that you just configured.

 

Ok, This seems to have worked, but now it seems I have to run the vi once to open the com port and once to get a response. Which is better . My only question would be: Why?

Capture.PNG

 

v2 snip.png

0 Kudos
Message 3 of 5
(3,695 Views)

The only other item I see that is different is the Flush Buffer, which you really do not need.

 

The other comment I have is to make sure that serial port is being closed.



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
0 Kudos
Message 4 of 5
(3,672 Views)

Lets take a closer look at your port settings.It looks like you have a conflict with flow control


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(3,662 Views)