Call to SIM 900

friis

Senior Member
Hi,
I have:

hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,$22,cr,"Pilot pot wet - send P, H or wait",$1A )
pause 200
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
sertxd (#ptr," ",#hSerPtr,cr,lf)
b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )
loop

I get:

119 179
119 179
Rx 65 "A"
120 179
Rx 84 "T"
121 179
Rx 43 "+"
122 179
Rx 67 "C"
123 179
Rx 77 "M"
124 179
Rx 71 "G"
125 179
Rx 83 "S"
__
__
__
Rx 119 "w"
171 179
Rx 97 "a"
172 179
Rx 105 "i"
173 179
Rx 116 "t"
174 179
Rx 26 "[1A]"
175 179 *
Rx 13 " *
" *
176 179 *
Rx 10 "" *
177 179 *
Rx 62 ">" *
178 179 *

i AM SURPRISED TO SEE THE LINES MARKED WITH *
CAN ANYONE EXPLAIN?

BEST REGARDS
TORBEN
 

PhilHornby

Senior Member
175 179 *
Rx 13 " * Carriage Return
" *
176 179 *
Rx 10 "" * Line feed
177 179 *
Rx 62 ">" * I assume this is its way of prompting for more input?
178 179 *
>

I've not used the SIM900, but this web page implies that the "AT" command should terminated by Ctrl-Z, not <CR>
 

inglewoodpete

Senior Member
Note that using the bit-banged SerTxd command while background serial data is being received will cause corruption of the received data. This is because the SerTxd command disables the system interrupts that background data reception (hSerial or hi2c) relies on.

However, I can see you have included a Pause 200 command, which probably allows the SIM900 to complete its response before your PICAXE proceeds to process the response data.
 

hippy

Ex-Staff (retired)
My understanding is that the telephone number part should be terminated by CR, the text being sent terminated by Ctrl-Z - which is $1A

After the number and CR are sent there can be a delay before the text is accepted but it seems to work.

I don't understand the ">". It could be a prompt for more data. I thought it should return an "OK" or other status message.

Something like this is what I would use to test things. Untested so some E&OE maybe -
Code:
Symbol CTRL_Z = 26
Symbol QUOTE  = "\""

hSerOut 0, ("AT+CMGS=", QUOTE, "+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13, QUOTE, CR)
Gosub ShowEcho
hSerOut 0, ("Pilot pot wet - send P, H or wait", CTRL_Z)
Do
  Gosub ShowEcho
Loop

ShowEcho:
  Pause 500
  Do
    Do While ptr <> hSerPtr
      SerTxd(#ptr, " ", #hSerPtr, " : ")
      b2 = @ptrInc
      b0 = b2 /  16 + "0" : If b0 > "9" Then : b0 = b0 + 7 : End If
      b1 = b2 // 16 + "0" : If b1 > "9" Then : b1 = b1 + 7 : End If
      SerTxd("$", b0, b1, " ", #b2)
      Select Case b2
        Case CR         : SerTxd(" CR")
        Case LF         : SerTxd(" LF")
        Case $20 To $7E : SerTxd(" ", QUOTE, b2, QUOTE)
      End Select
      SerTxd(CR, LF)
    Loop
    Pause 500
  Loop While ptr <> hSerPtr
  Return
 

friis

Senior Member
Hi
Sorry about the delay - hard- and software problems. Here is what I have:

hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,$22,cr)
hSerOut 0, ( "Pilot pot wet - send P, H or wait",$1A )
gosub EndATcommand

EndATcommand:
pause 200
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )
loop
return

This is a routine proposed by hippy some years ago.

The first time I run it the phone routine, the end of the scratch pad is like:

x 116 "t"
Rx 26 "[1A]"
Rx 13 "
"
Rx 10 ""
Rx 62 ">"
Rx 32 " "

and the following subroutines are OK. The following time:

x 116 "t"
Rx 26 "[1A]"
Rx 13 "
"
The end that should be there is missing and the following subroutines go bad.

So, every second phone run is "OK", every second goes bad.

In the beginninhg ptr and hSerPtr are incorrect, and there are pieces of text that should not be there, but they later stabilises on the correct values for the two types.

I will check hippy's routine..

Any ideas?
Best regards
torben
 

friis

Senior Member
Hi hippy,
Here is the result of running your routine:

*Phone
97 138 : $41 65 "A"
98 138 : $54 84 "T"
99 138 : $2B 43 "+"
100 138 : $43 67 "C"
101 138 : $4D 77 "M"
102 138 : $47 71 "G"
103 138 : $53 83 "S"
104 138 : $3D 61 "="
105 138 : $22 34 """
106 138 : $2B 43 "+"
107 138 : $04 4
108 138 : $05 5
109 138 : $08 8
110 138 : $01 1
111 138 : $01 1
112 138 : $01 1
113 138 : $06 6
114 138 : $07 7
115 138 : $05 5 *6?
116 138 : $05 5
117 138 : $22 34 """
118 138 : $0D 13 CR
119 138 : $0D 13 CR *superfloues?
120 138 : $0A 10 LF *superfloues?
121 138 : $2B 43 "+"
122 138 : $43 67 "C"
123 138 : $4D 77 "M"
124 138 : $45 69 "E"
125 138 : $20 32 " "
126 138 : $45 69 "E"
127 138 : $52 82 "R"
128 138 : $52 82 "R"
129 138 : $4F 79 "O"
130 138 : $52 82 "R"
131 138 : $3A 58 ":"
132 138 : $20 32 " "
133 138 : $37 55 "7" *superfloues?
134 138 : $36 54 "6"
135 138 : $35 53 "5" *superfloues?
136 138 : $0D 13 CR
137 138 : $0A 10 LF *superfloues?
138 172 : $50 80 "P"
139 172 : $69 105 "i"
140 172 : $6C 108 "l"
141 172 : $6F 111 "o"
142 172 : $74 116 "t"
143 172 : $20 32 " "
144 172 : $70 112 "p"
145 172 : $6F 111 "o"
146 172 : $74 116 "t"
147 172 : $20 32 " "
148 172 : $77 119 "w"
149 172 : $65 101 "e"
150 172 : $74 116 "t"
151 172 : $20 32 " "
152 172 : $2D 45 "-"
153 172 : $20 32 " "
154 172 : $73 115 "s"
155 172 : $65 101 "e"
156 172 : $6E 110 "n"
157 172 : $64 100 "d"
158 172 : $20 32 " "
159 172 : $50 80 "P"
160 172 : $2C 44 ","
161 172 : $20 32 " "
162 184 : $48 72 "H"
163 184 : $20 32 " "
164 184 : $6F 111 "o"
165 184 : $72 114 "r"
166 184 : $20 32 " "
167 184 : $77 119 "w"
168 184 : $61 97 "a"
169 184 : $69 105 "i"
170 184 : $74 116 "t"
171 184 : $1A 26
172 184 : $0D 13 CR *the rest should not be there?
173 184 : $0A 10 LF
174 184 : $2B 43 "+"
175 184 : $43 67 "C"
176 184 : $52 82 "R"
177 184 : $45 69 "E"
178 184 : $47 71 "G"
179 184 : $3A 58 ":"
180 184 : $20 32 " "
181 184 : $31 49 "1"
182 184 : $0D 13 CR
183 184 : $0A 10 LF

I think I need help to interpret it.
Best regards
torben
 

friis

Senior Member
Hi,
I should mention that I split the at command because I need the space it saves me.
torben
 

hippy

Ex-Staff (retired)
107 138 : $04 4
108 138 : $05 5
109 138 : $08 8
110 138 : $01 1
111 138 : $01 1
112 138 : $01 1
113 138 : $06 6
114 138 : $07 7
115 138 : $05 5 *6?
116 138 : $05 5
Looks like the phone number is being sent as binary numbers rather than as ASCII characters. I had missed that earlier. I would try adding the '#' to make it the following -
Code:
hSerOut 0, ( "AT+CMGS=",$22,"+",#b4,#b5,#b6,#b7,#b8,#b9,#b10,#b11,#b12#,b13,$22,cr)
 

friis

Senior Member
Hi hippy,
You are right. Thank you very much. PieM, same thing.
I have made a pgm with 3 consecutive sms:

hSerOut 0, ( "AT+CMGS=",$22,"+",#b4,#b5,#b6,#b7,#b8,#b9,#b10,#b11,#b12,#b13,$22,cr,"Pilot pot wet - send H, A - or wait",$1A)
gosub EndATcommand
pause 6000

The first one is OK, the second one is missing the ">" sign at the end and the third is not run at all (ptr = hSerPtr).

So, the problem has nothing to do with splitting of the command.
torben
 

friis

Senior Member
Hi hippy,
I am confused.

I have a pgm with two identical subroutines: Phone1 and Phone2. When I run the pgm:

gosub Phone1
pause 3000
gosub phone2

I only receive one SMS, namely that sent by Phone2.

The scratchpad for Phone1 ends:

Rx 26 "[1A]"
Rx 10 ""
Rx 13 "
"
Rx 10 ""
Rx 62 ">"
Rx 32 " "

and the one for Phone2 ends:

Rx 26 "[1A]"
Rx 10 ""

How can the scratchpad end differently for two identical subroutines?
Why is only Phone2 actually send a sms?
In the sms sent by Phone2 the actual message is prefixed by: AT+CMGS="+4581116757" - which is correct.
In the real pgm Phone1 was the one that allowed the subroutines that follow to run OK, while the subroutines following Phone2 went haywire.
Can anybody make sense of this?
torben
 

friis

Senior Member
Hi hippy, PieM, inglewoodpete and PhilHornby,
The problem appears to have been power supply. I took the power for the Picaxe28X2 from an outlet on the SIM900. Both sending and supplying the 28X2 was too much, so now the 28X2 has it's own power supply.
I am sorry to have wasted so much of your time on a non-Picaxe issue.
Best regards
torben
 

friis

Senior Member
Hi PieM,
But I found out I have 3 amp from my wall wart. So I am still looking for an explanation.
torben
 

hippy

Ex-Staff (retired)
The phone should send on receipt of Ctrl-Z ($1A) and there can be a delay between that and emitting its ready for its next command prompt (">").

A difference could come down to phone firmware, SIM card, even network, maybe simply not waiting long enough. If you swap the phones over you should be able to tell if the issue remains as per the order in the PICAXE code or moves with the phone.
 

PieM

Senior Member
Hi PieM,
But I found out I have 3 amp from my wall wart. So I am still looking for an explanation.
torben
It is never advisable to use mains power supplies with SIM 900 Module.
And pause after hserout are necessary !
I use 500 to1000 for SIM 900, 2000 for TC35 and 500 with A6 module.
 

friis

Senior Member
Hi PieM,
I have tried in a pgm testing the phone routine:
gosub Phone
gosub CheckPH

gosub Phone
gosub CheckPH

The phone is OK now, but the CheckPH echos +CMGS12.....OK (no AT). The problem is, that Check does not contain AT+CMGS but AT+CMGR=1.
And that does not show up.
And I have to use "pause 15000 sec." (I have freq m16) in the loop showing the scratch pad.
This is with another phone.
Any ideas?
torben
 

hippy

Ex-Staff (retired)
The phone is OK now, but the CheckPH echos +CMGS12.....OK (no AT). The problem is, that Check does not contain AT+CMGS but AT+CMGR=1.
And that does not show up.
It's perhaps best to post you full current code and the full output of what you are seeing as it's difficult to tell exactly what you mean, what may be wrong.
 

friis

Senior Member
Hi hippy,
One hint:

1st phone call scratch pad:

*Phone
87 147
Rx 65 "A"
Rx 84 "T"
Rx 43 "+"
Rx 67 "C"
Rx 77 "M"
Rx 71 "G"
Rx 83 "S"
Rx 61 "="
Rx 34 """
Rx 43 "+"
Rx 52 "4"
Rx 53 "5"
-
-
-
-
Rx 97 "a"
Rx 105 "i"
Rx 116 "t"
Rx 26 "[1A]"
Rx 13 "
"
Rx 10 ""
Rx 62 ">"
Rx 32 " "
*PHinfo
*CheckPH

Phinfo and CheckPH run OK.

2nd phone call end of scratch pad:

Rx 97 "a"
Rx 105 "i"
Rx 116 "t"
Rx 26 "[1A]"
Rx 13 "
"

*PHinfo

Phinfo runs OK. CheckPH inserts "+CMGS: 238 OK before the expected AT+CMGR=1 OK-

3rd phone call end of scratch pad:

Rx 97 "a"
Rx 105 "i"
Rx 116 "t"
Rx 26 "[1A]"
Rx 13 "
"
Rx 10 ""
Rx 62 ">"
Rx 32 " "
*PHinfo
*CheckPH

Phinfo and CheckPH run OK.

So, every second runs OK (although the ">" is rather annoying because it continues after the OK runs)

Test pgm:

PowerOnReset:
SerTxd( Cr, LF, "Started PowerOnReset", CR, LF )

b4 = 4
b5 = 5
b6 = 8
b7 = 1
b8 = 1
b9 = 1
b10 = 6
b11 = 7
b12 = 5
b13 = 7
b14 = "#"
b15 = "#"
b16 = "#"
b17 = "#"

Data1 = 61001

gosub Phone
pause 2000
gosub PHinfo
pause 6000
gosub CheckPH

pause 6000

gosub Phone
pause 2000
gosub PHinfo
pause 6000
gosub CheckPH

pause 6000

gosub Phone
pause 2000
gosub PHinfo
pause 6000
gosub CheckPH

end
EndATcommand:
pause 200
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )
loop


return
CheckPH:
sertxd ("*CheckPH",cr,lf)

hSerOut 0, ( "AT+CMGR=1",cr)
pause 200
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
sertxd ("AT+CMGR=1: ",#ptr," ",#hSerPtr,cr,lf)

b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )

b32 = b31
b31 = b30
b30 = b0
i = i + 1

if b30 = 13 then
if b31 = 72 OR b31 = 65 then
if b32 = 10 OR b32 = 32 then
'gosub DeleteRec
'gosub TX
endif
endif
endif
loop

b32 = 0
b31 = 0
b30 = 0

return
Phone:
sertxd ("*Phone",cr,lf)

if b14 = "#" then 'send msg to phone
hSerOut 0, ( "AT+CMGS=",$22,"+",#b4,#b5,#b6,#b7,#b8,#b9,#b10,#b11,#b12,#b13,$22,cr)
'gosub EndATcommand
elseif b15 = "#" then
hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,$22,cr)
gosub EndATcommand
elseif b16 = "#" then
hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,$22,cr)
gosub EndATcommand
elseif b17 = "#" then
hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,$22,cr)
gosub EndATcommand
endif

if Data1 = 61001 then 'pilot pot too wet
hSerOut 0, ( "Pilot pot wet - send P, H or wait",$1A )
gosub EndATcommand
elseif Data1 = 61002 then 'pilot pot too dry
hSerOut 0, ( "Pilot pot dry - send H or wait",$1A )
gosub EndATcommand
elseif Data1 = 61003 then
hSerOut 0, ( "Power < 3.5 V - send H or wait",$1A )
gosub EndATcommand
endif

return
PHinfo:
sertxd ("*PHinfo",cr,lf)

if Data1 = 61001 then
gosub BeginWtoDispl
serout b.1,N2400_4,("Send Pause or ")
serout b.1,N2400_4,(254,192)
serout b.1,N2400_4,("Halt - or wait ")
setfreq m16
elseif Data1 = 61002 OR Data1 = 61003 then
gosub BeginWtoDispl
serout b.1,N2400_4,("Send Halt or ")
serout b.1,N2400_4,(254,192)
serout b.1,N2400_4,("or wait ")
setfreq m16
endif

return
torben
 

friis

Senior Member
Hi hippy,
I should mention that the numbers given for ptr and hSerPtr fit the actual listings.
torben
 

hippy

Ex-Staff (retired)
I can't figure it out so what I would suggest doing is going back to basics. Run the PICAXE at its default frequency, forget about the HC12, forget about the LCD, just try to get consecutive SMS messages sent out of the phone.

I don't have the hardware to test but this is what I would start with, check that the phone number at the top is correct -
Code:
#define PHONE_NUMBER "+458111675"

Symbol  QUOTE  = $22
Symbol  CTRL_Z = $1A

#Macro Char(chr)
  b0 = chr
  Gosub OutputB0
#EndMacro

#Macro Text(txt)
  b1 = 0
  Do
     Lookup b1, (txt, 0), b0
     If b0 <> 0 Then
       Gosub OutputB0
       b1 = b1 + 1
     End If
  Loop Until b0 = 0
#EndMacro

#Macro SendSms(msg)
  SerTxd(CR, LF, "Send > ")
  Text("AT+CMGS=")
  Char(QUOTE)
  Text(PHONE_NUMBER)
  Char(QUOTE)
  Char(CR)
  Gosub ShowEcho              ; <--- Added - See later post
  Text(msg)
  Char(CTRL_Z)
  Gosub ShowEcho
  Gosub ReadSms
#EndMacro

PowerOnReset:
  HSerSetup B115200_8,%001
  Pause 2000
  SerTxd("Started", CR, LF)

InitialisePhone:
  SerTxd("Init > ")
  Text("AT")
  Char(CR)
  Gosub ShowEcho

  SerTxd("Init > ")
  Text("AT+CREG?")
  Char(CR)
  Gosub ShowEcho
     
  SerTxd("Init > ")
  Text("AT+CPIN?")
  Char(CR)
  Gosub ShowEcho

  SerTxd("Init > ")
  Text("AT+CMGF=1")  
  Char(CR)
  Gosub ShowEcho

MainProgram:
  SendSms("This")
  SendSms("is")
  SendSms("fun")
  End

ReadSms:
  SerTxd("Read > ")
  Text("AT+CMGR=1")
  Char(CR)
  Gosub ShowEcho
  Return

OutputB0:
  Gosub ShowB0
  #IfDef SIMULATING
    w10 = ptr
    ptr = hSerPtr
    @ptrInc = b0
    hSerPtr = ptr
    ptr = w10
  #Else
    HSerOut 0, (b0)
  #EndIf
  Return

ShowEcho:
  Pause 2000
  Do While ptr <> hSerPtr
    SerTxd(CR, LF, "Echo < ")
    Do While ptr <> hSerPtr
      b0 = @ptrInc
      Gosub ShowB0
    Loop
    SerTxd(CR, LF)
    Pause 100
  Loop
  Return

ShowB0:
  If b0 > $20 And b0 < $7E Then
    SerTxd(b0)
  Else
    b3 = b0 / 16 + "0" : If b3 > "9" Then : b3 = b3 + 7 : End If
    b2 = b0 & 15 + "0" : If b2 > "9" Then : b2 = b2 + 7 : End If
    SerTxd("[", b3, b2, "]")
  End If
  Return
 
Last edited:

friis

Senior Member
Hi hippy,
I have fiddled with the pauses in the attached pgm and it sent 10 correct mails. But I do not know what is going on.
Besr regards
torben
 

Attachments

hippy

Ex-Staff (retired)
I have fiddled with the pauses in the attached pgm and it sent 10 correct mails. But I do not know what is going on.
It seems to me that it simply is the case that there can be a delay between sending the AT+CMGS command, it offering up the prompt for the message text, and after sending the message being ready to accept the next command.

That's not particularly surprising as the phone needs to check the SIM card, talk to the base station and the infrastructure beyond the base station, to know if it can do what is being requested. It's not unlike going to a web site and it sometimes being slow to respond.

Don't forget that at 16MHz the PAUSE time numbers are twice as long as the pause times invoked.
 

friis

Senior Member
Hi hippy,

I am not sure if you got this:

Thank you very much for your pgm. I ran it with the following result:

Init > AT[0D]
Echo < AT[0D][0D][0A]OK[0D][0A]
Init > AT+CREG?[0D]
Echo < AT[0D][0D][0A]+CREG:[20]0,1[0D][0A][0D][0A]OK[0D][0A]
Init > AT+CPIN?[0D]
Echo < AT[0D][0D][0A]+CPIN:[20]READY[0D][0A][0D][0A]OK[0D][0A]
Init > AT+CMGF=1[0D]
Echo < AT[0D][0D][0A]OK[0D][0A]

Send > AT+CMGS="+4581116757"[0D]This[1A]
Echo < AT[89][AA][C2][8A][8A][8A][B2][BA][AA][BA][12][FE][0D]T
Read > AT+CMGR=1[0D]
Echo < [0D][0A]+CMGS:[20]27[0D][0A][0D][0A]OK[0D][0A]

Send > AT+CMGS="+4581116757"[0D]is[1A]
Echo < AT[0D]i
Read > AT+CMGR=1[0D]
Echo < [0D][0A]+CMGS:[20]28[0D][0A][0D][0A]OK[0D][0A]

Send > AT+CMGS="+4581116757"[0D]fun[1A]
Echo < AT[0D]f
Read > AT+CMGR=1[0D]
Echo < [0D][0A]+CMGS:[20]29[0D][0A][0D][0A]OK[0D][0A]

Is it right that only a "T" is returned? Are some commas missing in the send command?
3 empty emails are sent.

If I replace the sending This with my code I get returned:

66 97
Rx 65 "A"
Rx 84 "T"
Rx 43 "+"
Rx 67 "C"
Rx 77 "M"
Rx 71 "G"
Rx 83 "S"
Rx 61 "="
Rx 34 """
Rx 43 "+"
Rx 52 "4"
Rx 53 "5"
Rx 56 "8"
Rx 49 "1"
Rx 49 "1"
Rx 49 "1"
Rx 54 "6"
Rx 55 "7"
Rx 53 "5"
Rx 55 "7"
Rx 34 """
Rx 13 "
"
Rx 84 "T"
Rx 104 "h"
Rx 105 "i"
Rx 115 "s"
Rx 26 "[1A]"
Rx 13 "
"
Rx 10 ""
Rx 62 ">"
Rx 32 " "
97 106
Rx 65 "A"
Rx 84 "T"
Rx 43 "+"
Rx 67 "C"
Rx 77 "M"
Rx 71 "G"
Rx 82 "R"
Rx 61 "="
Rx 49 "1"

The initiation of the phone works as before. but there must be something wrong with the combination of my call and the subroutine :

EndATcommand:
pause 200
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )
loop

return

Only one sms with an "i" and some text that should not be there is sent.

There must be something wrong with the combination of my call and the subroutine, but what?
Best regards
torben
 

hippy

Ex-Staff (retired)
The good news is -

Init > AT+CPIN?[0D]
Echo < AT[0D][0D][0A]+CPIN:[20]READY[0D][0A][0D][0A]OK[0D][0A]

That and the rest of the initialisation seems right.

Read > AT+CMGR=1[0D]
Echo < [0D][0A]+CMGS:[20]27[0D][0A][0D][0A]OK[0D][0A]

That seems right; the 27 incrementing to 28 and then 29 as the three SMS messages were sent.

Send > AT+CMGS="+4581116757"[0D]This[1A]
Echo < AT[89][AA][C2][8A][8A][8A][B2][BA][AA][BA][12][FE][0D]T

That seems to be pretty mangled, though it's ready to accept the subsequent AT+CMGR=1.

I am guessing that's because I didn't follow my own advice, didn't pause after the phone number's CR before sending the message.

I have added an extra ' Gosub ShowEcho' before the 'Text(msg)' in the 'SendSms' macro in my earlier code. I would suggest doing the same and seeing if that improves things.
 

friis

Senior Member
Hi hippy,
Thank you.. Your pgm is more sophisticated than mine and I am still studying it. My fiddling resulted in the following:

if b14 = "#" then 'send msg to phone
hSerOut 0, ( "AT+CMGS=",$22,"+",b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,$22,cr)
pause 3500
endif

if Data1 = 61001 then 'pilot pot too wet
hSerOut 0, ( "Pilot pot wet - send P, H or wait",$1A )
gosub EndATcommand1
endif

EndATcommand1:
pause 15000
sertxd (#ptr," ",#hSerPtr,cr,lf)
do while ptr <> hSerPtr
b0 = @ptrInc
SerTxd ( "Rx", tab, #b0, tab, $22, b0, $22, cr,lf )
loop

return

and it works.

I may have to use your pgm which in the echo appears to hve a lot of CR and LF that is not in the echo in my pgm if I want to know what is going on.

In the mean time the problem of "stack underflow" has turned up in a return statement in simulation (the "real" pgm just goes haywire) in an old comment in "Forums". You propose to add End to the pgm. But my pgm does not end - it circles back to the beginning (goto Main) Any ideas?
torben
 
Top