News:

Let's find out together what makes a PIC Tick!

Main Menu

SMS Text no longer working

Started by Bravo, Jul 17, 2023, 07:04 AM

Previous topic - Next topic

Bravo

Hi All,
I am going nuts with what should dead simple, & I have been on this urgent mission for 10 days now, working backwards to get to the bare basics now.  I need to sends SMS messages using a SIM800 module, which I have done many times before.
Just trying to send "Test" can't be achieved at the moment.  I have a working portable alarm using the SIM800 GSM module. I have checked the the SIM card & the SIM800 module in the working alarm which works with these items. I have copied the code from the alarm, but it does not work. I have monitored the Rx Tx lines with a logic analyser.
I get OK after each line until the end where  ERROR is shown at the end of the echoed text.  I am am wondering if there is an issue with  Cntl+Z which is needed to enable the text to be sent.  All the other projects I have done involving SMS text use    HSerOut [26]     ' this is ASCII for Ctrl+Z
The last new code which included working text was done by me about 8 months ago.
Has anything in the compiler changed that would affect this [26]  so that it  no longer achieves cntrl+Z .  Alternatively, is there another way to send Ctrl+ Z,

Here is  the not working code:
SMS:
               HSerOut ["AT",13]
               HSerOut ["AT+CMGF=1" ,13]
               
               HSerIn 5000,SMS,[Wait("OK")] ' wait for response ok for 5 seconds
               HSerOut ["AT+CMGS=+642040181xyz"]     ' #### my number
              HSerOut [13]
              Set led2
               HSerIn 5000,SMS,[Wait("OK")]
              HSerOut [ "#",Dec me,"Test"  ]
              HSerOut [13]
         
              DelayMS 10
              HSerOut [26] ' this is ASCII for Ctrl+Z
              HSerOut [13]
              Clear led2
              HSerIn 15000 ,SMS ,[Wait("+CMGS")]
              DelayMS 50


I am in New Zealand, where 2G still has a year to go on Vodaphone.
Any help would be greatly appreciated.
 
Retired RF Tech

trastikata

QuoteHSerOut [ "#",Dec me,"Test"  ]

What is Dec me in the string you send?

Bravo

Retired RF Tech

Craig

#3
Hi Bravo
This is a Simple Working Test on a M66 Quectel Module asking for an Airtime Balance.
It works fine on our Local South African Networks MTN & Vodacom on 2G.
It should be similar to the SIM800 Module.
Regards
Craig
 

'-------------------------------------------------------------------------------
' Airtime Balance  M66 Quectel Manual Command String Example AT+CUSD=1,"*100#",15
' Notes: 34 = " , 62 = > , 26 = Cntrl- z
'===============================================================================
AIR:
  Cls
  DelayMS 5
  Print At 0,0, "SETUP_TEXT MODE "                  ' Set The M66 to "TEXT MODE"
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display
  HSerOut1 ["AT+CMGF=1",13]                        ' Send AT Command  HSerOut ["AT+CMGF=1",13]
  HSerIn1 3000,Paint,[Wait( "O" ) ,temp1]          ' Wait For Reply from Ublox and place into Variable Temp1
  Print At 0,20," O ",temp1                        ' Print OK on the LCD to Confirm the variable received from the Ublox
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display
  DelayMS 500
  Cls
  GoSub Ackn                                        ' Flash RED LED to indicate that this has been done
  Print At 0,30,"  AirTime Bal?  "
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display

  HSerOut1 ["AT+CUSD=1,",34,"*136#",34,",15",13]    ' Use*136# for MTN & Vodacom (South Africa) to Check Balances
  HSerIn1 5000,Paint,[Wait("+") ,Airtime]            ' Incomming String is: +CUSD:_1,"AIRTIME:R30.87 (Can take up to 3 Seconds)   

  z = 0                                              ' Clear the Counter
  For z = 0 To 31 Step 1                            ' For z = 0 To 85 Step 1  ' [For z = 0 To 18 Step 1 Works Perfectly for MTN]
  Print At 0,0,"Air: ",Airtime[z],"  "                                          ' [For z = 0 To 31 Step 1 Works Perfectly For VODACOM]
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display
  DelayMS 500
  Next

  Cls
  DelayMS 5
  Print At 0,0,"ARR: ",Airtime[13],Airtime[14],Airtime[15],Airtime[16],Airtime[17],Airtime[18]  ' Print Only the Money Value on MTN
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display
  DelayMS 2000
  Cls
  DelayMS 5
  Print At 0,0,"AirT: ",Airtime,"  "
  RefreshDisplay()                                  ' Send video buffer (PIC RAM) to the display
  DelayMS 2000
  HSerOut1 [Str Airtime \31,13]                    ' MTN use = HSerOut[Str Airtime \18,13]
  DelayMS 2000                                      ' VODACOM use = HSerOut[Str Airtime \31,13]

  HSerOut1 ["sending sms",13]
  HSerOut1 ["AT+CMGS="]
  DelayMS 100
  HSerOut1 [34]
  DelayMS 100
  HSerOut1 ["+2779817...."]                        ' Your Cell number Here With Your country Code
  DelayMS 100
  HSerOut1 [34]
  DelayMS 100
  HSerOut1 [13]
  DelayMS 100

  For x = 4 To 31                                                              '  MTN use = For x = 4 To 18  ' VODACOM use = For x = 4 To 31
  HSerOut1 [Airtime
[x]]                                                    '  HSerOut1 [Airtime(x)]    NB!! USE ALL SQUARE BRACKETS HERE AND NOT ROUND BRACKETS (Does not Show correctly in Post) 
  Next

    DelayMS 2000
  HSerOut1 [$1A]

  HSerIn1 10000,Cont, [Wait("+CMGS:"),temp1,temp2,temp3]
  HSerOut1 ["SMS= ",temp2,temp3,13]
  HSerOut1 ["AT+CUSD=0",13]
  HSerOut1 ["switch off cusd",13]
  DelayMS 1000
  GoTo Cont                                        ' Return to main screen
Return


Bravo

Hi Craig,
Thanks for your help, I will  give it a test in the morning.
I moved to NZ about 15 years ago from Zim, because they have power, water & petrol here. I hear that things are not great in SA these days.
Cheers,
Gary
Retired RF Tech

Bravo

Hi Craig,
Thanks so much. Your code with mods worked. I vaguely remember something about extra quotes around the number, but it was 3 years ago, & the number went into a string & then a second string to add the extra quotes. So it was not obvious looking at my old codes. So it was not the compiler. I reverted back to the last Proton compiler. I will have to upgrade back to the present Positron version.

Best regards,
Gary

 
Retired RF Tech