Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How print " in serial port
26-11-2012, 09:26 PM,
#1
How print " in serial port
I am currently working with a GSM modem, and this requires that we send AT commands from the serial port, one of these commands is written as:
AT + CMGS = "13916049104"

But if I try to write obiamente a string "this code will assume that the cut is a separation .. how I can do it ...
Reply
26-11-2012, 10:36 PM,
#2
RE: How print " in serial port
AT + CMGS = \"13916049104\"

Give that a try Smile

(26-11-2012, 09:26 PM)PaX Wrote: I am currently working with a GSM modem, and this requires that we send AT commands from the serial port, one of these commands is written as:
AT + CMGS = "13916049104"

But if I try to write obiamente a string "this code will assume that the cut is a separation .. how I can do it ...
Boards:
Arduino uno full, 2009 barebones
* Arduino version: 1.0.3 beta
* Processing version: 2.-0a4
PIC32-Pinguino MX440F rev. c
* Pinguino version: svn latest x.3
STM32F-Discovery
Arduino shields:
W5100 Ethernet and SD
OS: ubuntu 12.10 64 bit
Reply
26-11-2012, 10:57 PM, (This post was last modified: 27-11-2012, 05:02 PM by mf01.)
#3
RE: How print " in serial port
Hi Pax and following on from gregoryfenton's post,

The use of "escape sequences" to deal with "problem characters" is documented in 1.3.2 Character Constants in the GNU C Reference Manual. If the simple escape sequence (\) does not work you could use the hexadecimal escape sequence \xhh for the corresponding ascii code.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
27-11-2012, 01:24 PM,
#4
RE: How print " in serial port
Yes but use \ not /

John
Reply
27-11-2012, 05:02 PM,
#5
RE: How print " in serial port
Whoops ! = Earlier post corrected.
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
03-12-2012, 10:25 PM,
#6
RE: How print " in serial port
THANK u all
Reply
08-01-2013, 02:33 PM,
#7
RE: How print " in serial port
(26-11-2012, 09:26 PM)PaX Wrote: I am currently working with a GSM modem, and this requires that we send AT commands from the serial port, one of these commands is written as:
AT + CMGS = "13916049104"

But if I try to write obiamente a string "this code will assume that the cut is a separation .. how I can do it ...

Hi
I am not convinced that you need the quotation marks and spaces. Usually you only have to send
AT+CMGS=13916049104
with a return \r at the end.
A common reply from a gsm modem after ths string is a prompt > after which you type your message followed by chr 26 (a CtrlZ) That prompt is tricky: some modems send it immediately, while others may occasionally take several seconds until it appears.

The other answers in this thread are quite valid Smile
Good luck, and look out for "unsolicited messages", a gsm modem may tell you things at any time when your software is doing something else!

Best regards
wimpy
Reply
12-01-2013, 05:47 PM,
#8
RE: How print " in serial port
(26-11-2012, 10:36 PM)gregoryfenton Wrote: AT + CMGS = \"13916049104\"

Give that a try Smile

(26-11-2012, 09:26 PM)PaX Wrote: I am currently working with a GSM modem, and this requires that we send AT commands from the serial port, one of these commands is written as:
AT + CMGS = "13916049104"

But if I try to write obiamente a string "this code will assume that the cut is a separation .. how I can do it ...

Shouldn't this be...?
AT + CMGS = "\"13916049104\""

Rather than...
AT + CMGS = \"13916049104\"
Reply
12-01-2013, 07:31 PM,
#9
RE: How print " in serial port
I doubt it. Anyway, I believe the previous replies worked for the user.

John
Reply
12-01-2013, 08:12 PM,
#10
RE: How print " in serial port
No indeed, my (additional) mistake; I think you should pass this string to the C statement:
"AT + CMGS = \"13916049104\""

to get the modem receive string:
AT + CMGS = "13916049104"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)