I'm working on a project that sends SMS via a SIM 800 gsm module.
It needs to send Greek Text as well, so I've enabled the CMGHEX mode and it works fine.
However the problem comes with the Greek leter Ξ, which in the GSM Alphabet has the value of 20 (hex: 1A).
So if I need to use that in a sentence and replace it with \x1A, it truncates the message at that character, as the \x1A is the carriage return in Arduino, so it sends the message as soon as it prints that character to the gsm Serial interface.
How can I send that letter without triggering the CR ?
So the \x1A sequence is the CTRL+Z equivalent, which you need to send to the GSM modem in order to send an SMS message.
So the format is
gsm.serialPrint("AT+CMGS=\"+30699999999\");
//Then send the message to the gsm serial
gsm.serialPrint("Test message");
//send the CTRL+Z to send it
gsm.serialPrint("\x1A");
My problem is that I need to send something like this:
gsm.serialPrint("AT+CMGS=\"+30699999999\");
//Then send the message to the gsm serial
gsm.serialPrint("TO KAPOY\x14I \x1A""EKINH\x18""E);
//send the CTRL+Z to send it
gsm.serialPrint("\x1A");
And my problem is that this message will truncate at the \x1A (Ξ) character.
Somehow, I need to escape this character in order to send it, by I don't know how.
Robin2:
Can you use Serial.write(0x1A); or Serial.write(26); ?
...R
Since the syntax of the OP's function is "[b]gsm.[color=blue]serialPrint[/color]()[/b]", I suspect that "serialPrint" is a function in his GSM library and he's not using the core [b]Serial.print/write[/b] (although I wonder if "[b]gsm.print()[/b]" or "[b]gsm.write()[/b]" would work?)
Ok, seems that this is impossible by the SIM800 design.
I was looking again at the AT Commands manual and noticed this:
Enable to send SMS varying from 0x00 to 0x7f except 0x1a and 0x1b under text mode and GSM character set
So basically the greek Ξ character is unavailable in this mode and only solution is to probably use PDU mode, which I don't want as it increases the sketch a lot.