10-10-2018 08:37 AM
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.
Solved! Go to Solution.
10-10-2018 08:43 AM
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"
10-10-2018 08:44 AM
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 .
10-10-2018 09:10 AM - edited 10-10-2018 09:11 AM
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. 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.
10-10-2018 09:27 AM - edited 10-10-2018 09:28 AM
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.
10-10-2018 09:42 AM - edited 10-10-2018 09:46 AM
@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
10-10-2018 09:45 AM - edited 10-10-2018 09:46 AM
Thanks Bill,
However I thought that the downwards arrow, before the typecast appended the LF on every message. My understanding is because Labview can't append two characters, you append the LF and have to add \r to the end of each message for the CR. Where have I gone wrong? Is it not appending the LF as I expected? I tried to add \n to the String with the escape codes display, but to no avail.
Edit: Just seen Jeff's post - good to know I'm not going crazy.
10-10-2018 09:53 AM
The problem is that you typecast the linefeed to a 32-bit integer. You need to typecast it to a U8. The I32 is being coerced into a U8. It's probably sending a 00h rather than a 10h.
10-10-2018 10:13 AM - edited 10-10-2018 10:14 AM
@JÞB wrote:
@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
Oh, I get it. I never use that property. If I need to append an outgoing terminating character (or two), I add them explicitly to the outgoing message instead. That, combined with the fact that I missed that setting in the picture (it is actually set twice) led to my mistake.
10-10-2018 10:17 AM - edited 10-10-2018 10:18 AM
Many thanks RavensFan, it was that sneaky i32 causing the timeouts all along. I now nearly have the program working, my returned String appears to be empty (displays only \r\n). I will have to be far more careful with my types.