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
(1,343 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
(1,343 Views)