This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sending sms throudh gsm modem code problem

hiii this is my code for sending sms throgh GSM MODEM ussing MICROCONTROLLER 8051....but im not getting output can u plz modify our code and tell suggestions if any.....i must submit my project in two days plz hgelp me out.....thanks....

org 0000h
start: mov TMOD, #20H mov TH1, #-3
mov SCON, #50H setb TR1
mov dptr,#mydata1

L1: clr a
movc a,@a+dptr
jz L3 clr ti
mov sbuf,a
inc dptr

L2:jnb ti,L2 sjmp L1
L3:mov a,#0dh clr ti mov sbuf,a

L4: jnb ti,L4 lcall delay mov dptr,#mydata2

L5: clr a movc a,@a+dptr jz L6 clr ti mov sbuf,a
inc dptr

L7:jnb ti,L7 Sjmp L5

L6:mov a,#0dh clr ti mov sbuf,a

L8:jnb ti, L8 lcall delay
mov dptr,#mydata3

L9: clr a
movc a,@a+dptr jz L10 clr ti mov sbuf,a
inc dptr

L11:jnb ti,L11 sjmp L9

L10: mov a,#1ah clr ti mov sbuf,a

L11:jnb ti, L11 CLR TR1 lcall delay1

mydata1:db 'at+cmgf=1',0

mydata2:db 'at+cmgs="MOBILE NUM"',0

mydata3:db ‘ MESSAGE TO BE TYPED ',0
delay: MOV R5,#20H
HERE3: MOV R6,#0FFH
HERE2: MOV R7,0FFH
HERE1: DJNZ R7,HERE1 DJNZ R6,HERE2 DJNZ R5,HERE3
RET
Delay1: mov r0,#0ffh
ahere2:mov r1,#0ffh
ahere1:djnz r1,ahere1 djnz r0,ahere2 ret
end

Parents
  • It is essential that you realise that modems (not just GSM modems) work on a command-response basis.

    This means that, before you send the next command, you must have received & correctly handled the response(s) from the previous command.

    You do this "naturally" when you type the commands manually at a terminal - but you must specifically code this into your software when doing it programmatically.

    In particular, when sending SMS with a GSM modem, you need to wait for the '>' prompt before you start sending the body of the message.

    Also, when typing manually, it is unlikely that you can type fast enough to get the next command in before the previous response - but a microcontroller can do it easily!

    This is probably the commonest beginner's mistake with AT commands.

Reply
  • It is essential that you realise that modems (not just GSM modems) work on a command-response basis.

    This means that, before you send the next command, you must have received & correctly handled the response(s) from the previous command.

    You do this "naturally" when you type the commands manually at a terminal - but you must specifically code this into your software when doing it programmatically.

    In particular, when sending SMS with a GSM modem, you need to wait for the '>' prompt before you start sending the body of the message.

    Also, when typing manually, it is unlikely that you can type fast enough to get the next command in before the previous response - but a microcontroller can do it easily!

    This is probably the commonest beginner's mistake with AT commands.

Children