LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send Ascii command Through RS232 Interface in labview

Hello,
 
I tried to use labview to control the CD2A Compudrive.
Actually I found the driver of CD2A online in the following link
but however, I still can't use this driver to send the command and adjust the parameter.
p.s. Use only "CD2A Setup" or "CD2A Init" should be enough to set the parameter and command, right?
 
 
The command code written in the CD2A Manual is, for example,
<STX>ST600<ETX><LF>   which is Start of Message,Start Position 600 nm, End of Message, Line Feed
I've tried to send this using MAX (Measurement & Automation Explorer), but the signal I got back is
 
−1073807298 = Could not perform operation because of I/O error.

For the command in the driver above,

The code is written in number form of ascii format  >> e.g. <STX> = ascii 02

and The Code is written as

\02ST600\03\r

But sending this code>> nothing happens

Which is quite confusing for me.

1. Is it general to write \02  to send <STX> signal??

2. actually <LF> = ascii 10  >> so why does it use    /r         instead?

3. What should I do, is my format correct???  I can't even send one signal to operate it at all.

 

Thank you very much for help

0 Kudos
Message 1 of 2
(11,425 Views)

A string control can set for 4 different types of display. When you right click on it, you can select Normal, '\' Codes, Hex, or Password. Normal is ASCII character and the unprintable characters such as <STX> cannot be entered. The <STX> is hex 02 so you enter this as \02. The '\' says to interpret the next byte as hex. A <LF> is not ASCII 10 at all. It is hex 0A. For readability, it was decided a long time ago that certain '\' characters could be represented a bit differently. If \n, that was hex 0A. A \r is hex 0D or the CR. You can find documentation on these stand C Escape Sequences. In LabVIEW, you can type \0A into your control and it will automatically convert or \n.

Your other option is to use hex display. You just enter all of the hex equivalents though it makes entering the ST600 a bit more difficult in your case.

I'm not sure if the data entry in MAX is set for '\' Code Display and whether it is interpretting your string correctly. I know that the Basic Serial Write and Read example in LabVIEW is set this way and you might want to try that.

0 Kudos
Message 2 of 2
(11,367 Views)