LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending the Escape Character

I'm using the NI Example "basic Serial Read and Write.vi" and I need to send the escape character.

I've poked around on this subject but the answer just isn't juping out at me. Any help?
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 1 of 8
(4,940 Views)

Hai,

Inorder to send the escape character just wire true to "Enable termination Character" input of the "visa configure serial port.vi" that will add the "line feed" constant to all the commands that is sent. or wire the any other constant(s) to "termination character" input so that those constants will be send as termination instead of the default line feed contant.

with best regards,

 

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 2 of 8
(4,936 Views)
Thanks,

But how do you propgramatically enter ESCAPE?

I know that the hexadecimal version of escape is 1B. Do I just wire that up as the input string? I've also seen the string \1BPS=1\r. Does the "\" character tell the Write VI that what comes next is hex control codes?
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 3 of 8
(4,925 Views)
The termination character that you enable with the VISA Configure Serial Port has nothing at all to do with a write. It is the character that will terminate a VISA Read. You can configure VISA to send a character automatically with with every write but if you only need to send it once, then there are several ways to do it. You can set the string control/constant for '\' Code Display and enter \1B for the string. You can set the string control/constant for Hex Display and enter 1B for the string. You can use a U8 numeric constant set to decimal 27 (x1B) and type cast it to a string. You can have a 1D U8 array with a single value of decimal 27 (x1B) and use the Byte Array to String.
0 Kudos
Message 4 of 8
(4,922 Views)
I'm closing on on this thing, but I can't figure out why I keep getting an extra "\" in the control string I try to pass the VI. Look at the attached VI. Everytime I select REMOTE (gets ready to send \1B), then OK to make it happen, an extra "\" is added.

If I forget the toggle switch and just go back to entering the data in the "string to write" window:

R\D command works (pases an R to the component I have hooked up, with a carriage return) and sets the device to Remote Mode, the "read string" reports the correct status, and interestingly enough, the "string to read" field automatically changes to R/r, which seems to work as well as R\D on subsequent attempts

\1B faithfully transmits the Escape character to the unit and returns it Local Mode, with the "read string" reporting the correct status.

Its only when I try to modify the VI for programatic operation, as rudimentarily shown in the attached VI, that the escape sequence goes wrong.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 5 of 8
(4,897 Views)
Sorry, I meant "When I select Local" it gets ready to send the Escape code.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 6 of 8
(4,896 Views)
P.S.

Even when I probe, just upstream of the Visa Write VI, the string appears correctly as \1B, but in the "string to write" field on the front panel, it shows as \\B
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 7 of 8
(4,893 Views)
OK, so I can right click and select "\ Codes Display", seems to take care of it just fine. Thanks
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 8
(4,889 Views)