LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing CR Character to port

Hi ,

 

I have a problem with a Simple RS232 Port...

 

Is there a function that writing CR termination to a serial port ?

 

I know i can simply write 13 DEC to the port just wondering if theres any thing build in for the cvi....

 

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 3
(3,121 Views)

Hi,

 

if you happen to use VISA you could use viSetAttribute ( session_handle, VI_ATTR_SEND_END_EN, ) and define VI_ASRL_END_TERMCHAR; this way the terminating character is automatically appended

Message 2 of 3
(3,117 Views)

Hi,

 

This does a string with CR at the end pretty well in an old version of labwindows:

 

Fmt(send_cmd,"%s<%c%i%s\r", SENDESC, i + 1, LIMITCOM);     //this  adds 1 to i  so send_cmd starts at 1L - Type of slot request

 

and then:

 

stringsize = StringLength (send_cmd);
   
    bytes_sent = ComWrt (COMPORT, send_cmd, stringsize)

 

Of course this is a char string: <ESC>1L<CR>.  Have a look at the serial.prj example for single bytes.  - NB both SENDESC and LIMITCOM are #defines with SENDESC 27 and LIMITCOM  "L"

 

Steve

0 Kudos
Message 3 of 3
(3,098 Views)