Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send ctrl-character on serial line?

I am looking for for a simple way to send special characters from a VI to a device over a serial line. In particular, the device is looking for ctrl-x, ctrl-y, and ctrl-z.

As an additional question, are there any example vi's that mimic terminal programs (e.g. hyperterm)?

Thanks in advance.
0 Kudos
Message 1 of 2
(4,784 Views)
Hi Todd,

With serial all you are sending is bytes. When sending text commands (or keys), the meaning of a byte is determine by the ASCII standard. So the questions is how you can represent does key strokes with ASCII.

This links has a FAQ on the ASCII code:
http://www.jimprice.com/jim-asc.htm

Ctrl-A is represented as 01. Ctrl-Z is 26. The rest of the characters fall in between.

Once you have the binary values for the ctrl keys you are interested in, you have two options to write the data to the serial port.

The VISA VI (or serial) use a string to handle the data. You can use a string control with the hex display (right-click on th control and select the display mode). This mode allows you to write the hex value of the bytes of the string
.

The other option is to make a byte array (numerics) and use the Byte Array to String VI. Locate in one of the palettes in the String function palette.

DiegoF.
National Instruments.
0 Kudos
Message 2 of 2
(4,784 Views)