How to send ASCII char while using GSM component.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
sysprofessional
Posts: 54
Joined: Sat Oct 26, 2013 7:16 pm
Has thanked: 28 times
Been thanked: 4 times
Contact:

How to send ASCII char while using GSM component.

Post by sysprofessional »

Hi,
I need to send ASCII character while using " GSM (EB066,Generic AT) " component in FC6.
there is two parameters in 'SendCommand' macro.
First parameter just used for string only,while 2nd parameter ' SendCR ' is a Byte variable,
SendCR=0 for disable ,and 1 or may be greater then 0 will enable SendCR, and it will send ASCII 13 to serial port.
how can send any other char ??????
Script option in component property also working as string.
SendMessage macro sending Char 26 (^z) over serial.
is it possible to send char 26 over serial if using Sendcommand?

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: How to send ASCII char while using GSM component.

Post by mnf »

Hi,

You should be able to add the value to the string as an escape sequence.

Code: Select all

"\xhh"
can be used to add a hex character constant or "\nnn" adds the value as octal, e.g. \101

You can also add multiple characters "\x1a\x1a" would be two ctrl z characters.

Similarly can use for single characters using '\xhh' though less useful.

See for examplehttps://en.m.wikipedia.org/wiki/Escape_sequences_in_C

Note that you need to use hex or octal not decimal values.

You could also add the characters to a string using

Code: Select all

.s[0] = 26
for example - don't forget a 0 terminator if you use this approach..

Martin

User avatar
sysprofessional
Posts: 54
Joined: Sat Oct 26, 2013 7:16 pm
Has thanked: 28 times
Been thanked: 4 times
Contact:

Re: How to send ASCII char while using GSM component.

Post by sysprofessional »

Thanks for help, its working nicely ,
btw i was using "\0x1a" that's not working,but "\x1a" working perfectly.

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: How to send ASCII char while using GSM component.

Post by mnf »

Glad to hear it's working.

The leading 0 as in .x = 0x25 is to let the compiler know that a number is coming - otherwise it would treat the value as a variable name (or identifier) - in this case x25.

Martin

Post Reply