From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to send a command to serial ?

Now I am use serial port(COM1) to control a motor,and
use VISA in lv.I am new to program serial port .
I hope someone tell me how to send the command
"?R"&CHR$(13) to COM1 .I can send "?R" with Write VISA.vi ,
but I do not know how to express CHR$(13).
Someone can tell me how to ,and better have a simple example vi.
Thanks in advance!
0 Kudos
Message 1 of 2
(2,254 Views)
Hi,

CHR$(13) is the ASCII code for Carriadge return. LabVIEW has the same syntax as C. The ASCII code for Carriadge return in C is \r. To send this character to the serial port, create a string control (or constant). Right click on it and choose "'\' Codes Display". You can now type your command like this: "?R\n".

Here are some of the C ASCII codes:
- \r : carriadge return (hex 13)
- \n : line feed (hex 10)
- \t : tab (hex 09)
- \s : space (hex 20)

I hope it will help you.
0 Kudos
Message 2 of 2
(2,254 Views)