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?
How to send ASCII char while using GSM component.
Moderator: Benj
- sysprofessional
- Posts: 54
- Joined: Sat Oct 26, 2013 7:16 pm
- Has thanked: 28 times
- Been thanked: 4 times
- Contact:
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: How to send ASCII char while using GSM component.
Hi,
You should be able to add the value to the string as an escape sequence. 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 for example - don't forget a 0 terminator if you use this approach..
Martin
You should be able to add the value to the string as an escape sequence.
Code: Select all
"\xhh"
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
Martin
- 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.
Thanks for help, its working nicely ,
btw i was using "\0x1a" that's not working,but "\x1a" working perfectly.
btw i was using "\0x1a" that's not working,but "\x1a" working perfectly.
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: How to send ASCII char while using GSM component.
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
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