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
  • "If you are currently using straight cable(i.e DB9 pin no 2 from one end to pin no 2 other end and pin no 3 from one end to pin no 3 other end) then change to cross cable (i.e DB9 pin no 2 from one end to pin no 3 other end and pin no 3 from one end to pin no 2 other end)"

    is the cable u discussed used to connect between pc and gsm modem????????

Reply
  • "If you are currently using straight cable(i.e DB9 pin no 2 from one end to pin no 2 other end and pin no 3 from one end to pin no 3 other end) then change to cross cable (i.e DB9 pin no 2 from one end to pin no 3 other end and pin no 3 from one end to pin no 2 other end)"

    is the cable u discussed used to connect between pc and gsm modem????????

Children
  • It is internal connections of RS 232 cable.

  • If your target hardware has the same connector and pinout as the PC, then the same cable should work.

    Obviously, if your target hardware has a different connector and/or pinout from the PC, then a different cable will be required!

    You also need to pay attention to the other control signals that may be required by your modem - see the modem Manual for details.

    See also: http://www.keil.com/forum/docs/thread10578.asp among very many others...

  • 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.

  • yes i got response and also my message was sent to the desired mobile number but when i again tried with at commands i.e when i typed AT it should give OK response but now im not getting that....can u tell me what may be the problem????????????

  • After sending SMS wait for some seconds the modem will respond with the message ID of the message, indicating that the message was sent correctly.

    When you will get reply from modem then type AT command