Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Mon Nov 20, 2017 2:16 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Apr 03, 2006 9:41 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
Question



How do I add an ascii character string for CR-LF to a string? What is the equivalent to chr$(13) in Qlarity Foundry?



Answer



The string "\r" is the Qlarity equivalent of a chr$(13) in Visual Basic.



If you are typing in the properties window, or anywhere you need a quoted string context, you can use "\r". For example: to send such a string out the serial port, you could use:



Code:
Transmit(com1, "This is a CR terminated string\r", false)




If the data you wished to transmit were in a string or byte array variable, you could use this syntax:



Code:
Transmit (com1, MyTxData  +"\r", false)




If you wish to add a CR-LF sequence, instead of a CR only, you would use "\r\n". If you wish to add arbitrary ASCII characters, you can substitute "\xNN" where NN represents exactly 2 hexadecimal digits that are the numeric ASCII value you wish to use.



Code:
'Transmit an STX character, followed by the data followed by a CR-LF and an ETX.



Transmit (com1, "\x02" + MyTxData + "\r\n\x03", false)

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group