Hi,
I am using a GM862-QUAD GSM modem from Roundsolutions, via AT commands generated from a PIC16F74 running picbasic pro.
here is my simplified code:
'Initialising Variables
TXPIN VAR PORTD.3 'TX PIN
RXPIN VAR PORTD.2 'RX PIN
RL1 VAR PORTB.2 'RELAY OUTPUT
STAT VAR PORTB.1 'STATUS LED
BAUD CON 396 'BAUD RATE = 2400 N 8 1
RELAYFLAG VAR BYTE
ADCON1 = 6
DEFINE OCS 4
START:
pause 3000 ' start up delay
'first command is to set the text mode
SEROUT2 TXPIN, BAUD, ["AT+CMGF=1",13] '-- answer 'OK'
PAUSE 2000 ' 2 second delay to allow modem more than enough
' time to respond
'text setup
SEROUT2 TXPIN, BAUD, ["AT+CSMP=17,167,0,0",13] '-- answer 'OK'
PAUSE 2000 ' allow modem to respond
'send a message without saving
SEROUT2 TXPIN, BAUD, ["AT+CMGS=",34,"xxxxxxxxxxx",34,13] '--answer '>'
PAUSE 500 'short delay
' add the body of the message ending with ctrl-z
SEROUT2 TXPIN, BAUD, ["WORK",26]
PAUSE 500 'short delay
HIGH STAT 'completion indicator
STOPLABEL:
' stay here when complete
GOTO STOPLABEL
The code started life out listening for the responses before continuing - but as I wasn't having much luck with it I stripped all this out!
Ok, so whats happening or not happening.
I have setup hyperterminal to send out these exact same commands and this works fine. I also have the luxary of a serial data analyser so I can monitor the data being sent and received. When send these commands via hyperterminal the modem sends the code to the number (note xxxxxxxxxxx - for privacy!) and all is well.
I then disconnect hyperterminal and instead connect my PIC circuit and let the code above run. I monitor the results on my serial analyser and the commands send to and received from the GSM modem look indentical! BUT THE MESSAGE AINT SENT! I cannot fathom what is going wrong!?
both the code and hardware seem to function because I get the same serial data - apart from hyperterm generated works and PIC generated doesnt!?
Can anyone advise.
Thank you and Regards
Tom
Bookmarks