News:

;) This forum is the property of Proton software developers

Main Menu

AT Command ?

Started by Craig, Nov 11, 2021, 02:48 PM

Previous topic - Next topic

Craig

Hi
Pic 18F47K42 with Positron8 Ver 4.0.10
I am trying to send an Air Time Balance Request (Pre Paid Cellphone Airtime), using "USSD Codes" to the Local Network operator.
I have used this request in the past and it has worked perfectly. 

HSerOut ["AT+CUSD=1,\"*141#\",15",13]

*141# is the Local Network Operators code to request an Airtime Balance ?

The Problem is that it now gives a Compilation Error When you use the Backslash "\". I have spent hours Googling this to alter the format but, I am still not winning!
How do I alter the Format to get this to work correctly?

Kind Regards
Craig

John Lawton

#1
Hi Craig,

your code compiles fine in the latest Positron 8 bit compiler.

John

trastikata

#2
Quote from: Craig on Nov 11, 2021, 02:48 PMThe Problem is that it now gives a Compilation Error When you use the Backslash "\". I have spent hours Googling this to alter the format but, I am still not winning!
How do I alter the Format to get this to work correctly?

Use the corresponding ASCII code instead - 92 for backslash - when building the string.

HSerOut ["AT+CUSD=1",92,"*141#",92,15,13]

The 15 at the end is Shift from ASCII.  Is that's what you meant? If not, then the string will look like this:

HSerOut ["AT+CUSD=1",92,"*141#",92,"15",13]

Also the quotes in your string seem to be at the wrong places.

Craig

Only got back to this now!

Thank you John and  Trastikata for your help, I like your idea Trastikata and will try it that way as well and see what the Modem gives back.

I have changed it to this: HSerOut ["AT+CUSD=1,\",*141#\,",15",13]
It now compiles correctly will test it too see if it reports back correctly from the modem!   

Kind Regards
Craig

Yasin

This is how I do the remaining balance query. Maybe it can help.

HSerOut2 ["AT+CUSD=1",13]                                   'Data Service Open
HSerIn2 200,CUSD_PASS1,[Wait("OK")]
HSerOut2 ["ATD*123#",13]
CUSD_PASS1:

Craig

Thanks very much Yasin

will have a look at it.
Regards
Craig