Ni.com is currently experiencing issues that may cause some pages to fail.

Support teams are actively working on the resolution.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appending CR and LF to string

Solved!
Go to solution

I'm interested in interfacing with an instrument which requires a CR and LF at the end of each message. I followed example 7 here but I get an error message telling me it times out. Can anybody offer advice as to my fault? The code is as below.

 

For further reference, I attempted to send the same command using termite, and with (what I believe) to be the exact same setup, I successfully read the result, as below.

 

Also, unfortunately the instrument does not have any feature for me to switch to a single termination character.

 

Thanks in advance for your help.

Download All
0 Kudos
Message 1 of 19
(4,781 Views)

Did you truly follow that example 7 all the way down to the note in the last sentence?

 

Right click your string constants and make sure they say \code style.  You should go to the Visible menu and make the display style visible.  My guess is that you have those as normal display and you are sending a literal backslash "r" backslash "n"

 

 

Message 2 of 19
(4,775 Views)

Magic time.

 

Consider showing the display style on string constants;) when set to escape codes display you will find out that there is no carriage return sent .


"Should be" isn't "Is" -Jay
Message 3 of 19
(4,774 Views)

Many thanks for the very fast replies.

 

It turns out I didn't follow it exactly, I should have slowed down a little and been more observant. Smiley Embarassed I think I've corrected it as per your recommendations, however I still get the same error, which I've attached below. I've also attached the labview code in case that would be of more use.

 

Fwiw, I've also attached the relevant section of the manual, but I don't think there are any surprises there.

Download All
0 Kudos
Message 4 of 19
(4,757 Views)

According to your manual, you need to send both the CR and the LF.  The VISA Read timeout is because the equipment is just sitting there waiting for a LF that never comes.  Meanwhile, your VISA Read gets frustrated sitting there waiting for a response that never comes because the equipment is sitting around waiting for the LF, and finally VISA Read just gives up.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 19
(4,737 Views)

@billko wrote:

According to your manual, you need to send both the CR and the LF.  The VISA Read timeout is because the equipment is just sitting there waiting for a LF that never comes.  Meanwhile, your VISA Read gets frustrated sitting there waiting for a response that never comes because the equipment is sitting around waiting for the LF, and finally VISA Read just gives up.


Not exactly.   The term char is enabled and a linefeed....brb   ... and the handshake looks right.. but term mode for reads is term char not xoff... that looks odd


"Should be" isn't "Is" -Jay