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