torana
Member level 2
HELLO FRIEND,
I AM TRYING TO SEND SMS FROM AT 89S51 BY USING SIM300 MODEM.
I AM USING FOLLOWING COMMANDS.
AT
AT+CMGF=1
AT+CMGS= ”MOBILE NO”
BUT NOT ABLE TO SEND SMS
But same Modem and commands are working fine with PC.
My hardware connection:
MCU + Max232+ DB9 connector with SIM 300 + max232+ DB9 connector
Both grounds are connected (both DB9)
2nd pin (MCU DB9) is connected to 3rd pin (MODEM DB9)
3rd pin (MCU DB9) (MCU DB9) 2nd pin (MODEM DB9)
SOFTWARE:
For sending command from MCU to SIM300
Baud rate: 9600
Sending command from MCU to SIM 300 (with out interrupt)
Receiving data from Modem, I am using interrupt. But it is not working correctly.
If I will connect PC instead of SIM 300 then I am able to see my command on PC hyper terminal.
I thing I am not getting any type of data from SIM 300.
For testing:
I write a simple code for sending AT command from MCU to SIM300. If my controller get any interrupt from SIM 300 then It will Toggle the led which is connected to MCU. Else the led Will be ON.
On this code My LED is in ON condition. So I feel My MCU is not getting Any Interrupt from SIM 300.
;--------------------------my CODE for only AT command-----------------------------
;--------to test after sending AT whether my modem giving data to MCU or not---------
org 00h ;
ljmp main ;
org 0023h ;
ljmp h4 ;
org 30h ;
main: mov 45h,#59h
setb p1.0
mov a,#38h
acall comwrt
acall delay
mov a,#0eh
acall comwrt
acall delay
mov a,#01h
acall comwrt
acall delay
mov a,#06h
acall comwrt
acall delay
; mov a,45h
; acall datawrt
; acall delay
mov tmod, #20h ;
mov th1, #0fdh ;
mov scon, #50h ;
setb tr1 ;
mov dptr, #mydata1 ;
h1: clr a ;
movc a, @a+dptr ;
jz h2;-----------------------max delay and then display from 45h & 46h
acall send ;
inc dptr ;
sjmp h1 ;
send: mov sbuf, a ;
h3: jnb ti, h3 ;
clr ti ;
ret
h2: mov r2,#30
a1: mov r3,#255
a2: mov r4,#255
a3: djnz r4,a3
djnz r3,a2
djnz r2,a1
mov a,45h
acall datawrt
acall delay
mihir: sjmp mihir
;
har:
mov tmod, #20h ;
mov th1, #0fdh ;
mov scon, #50h ;
mov ie, #10010000b ;
setb tr1
h4: cpl p1.0;----------------------compliment led
clr ie.7;-------------------------disable interrupt
mov a,#00h
jb ti, trans ;
mov a, sbuf ;
;---------------------------------store the value A in to 45h
mov 45h,a
mov a,45h
acall datawrt
acall delay
mov 45h,#36h
;----------------------------------------------------------------
;next-------------- display the data from 45h in to LCD ( display for some time)
;load 45H= $
;return from interrupt
clr ri ;
reti ;
trans: clr ti ;
reti ;
comwrt: mov p2, a ;
clr p0.1 ;
setb p0.0 ;
acall delay ;
clr p0.0 ;
ret ;
datawrt:mov p2, a ;
setb p0.1 ;
setb p0.0 ;
acall delay ;
clr p0.0 ;
ret ;
delay: mov r3, #255 ;
here2: mov r4, #255 ;
here: djnz r4, here ;
djnz r3, here2 ;
ret
;
;
org 400H ;
mydata1:db 'AT',0dh,0 ;
end
Thank you.
_________________
NPES
I AM TRYING TO SEND SMS FROM AT 89S51 BY USING SIM300 MODEM.
I AM USING FOLLOWING COMMANDS.
AT
AT+CMGF=1
AT+CMGS= ”MOBILE NO”
BUT NOT ABLE TO SEND SMS
But same Modem and commands are working fine with PC.
My hardware connection:
MCU + Max232+ DB9 connector with SIM 300 + max232+ DB9 connector
Both grounds are connected (both DB9)
2nd pin (MCU DB9) is connected to 3rd pin (MODEM DB9)
3rd pin (MCU DB9) (MCU DB9) 2nd pin (MODEM DB9)
SOFTWARE:
For sending command from MCU to SIM300
Baud rate: 9600
Sending command from MCU to SIM 300 (with out interrupt)
Receiving data from Modem, I am using interrupt. But it is not working correctly.
If I will connect PC instead of SIM 300 then I am able to see my command on PC hyper terminal.
I thing I am not getting any type of data from SIM 300.
For testing:
I write a simple code for sending AT command from MCU to SIM300. If my controller get any interrupt from SIM 300 then It will Toggle the led which is connected to MCU. Else the led Will be ON.
On this code My LED is in ON condition. So I feel My MCU is not getting Any Interrupt from SIM 300.
;--------------------------my CODE for only AT command-----------------------------
;--------to test after sending AT whether my modem giving data to MCU or not---------
org 00h ;
ljmp main ;
org 0023h ;
ljmp h4 ;
org 30h ;
main: mov 45h,#59h
setb p1.0
mov a,#38h
acall comwrt
acall delay
mov a,#0eh
acall comwrt
acall delay
mov a,#01h
acall comwrt
acall delay
mov a,#06h
acall comwrt
acall delay
; mov a,45h
; acall datawrt
; acall delay
mov tmod, #20h ;
mov th1, #0fdh ;
mov scon, #50h ;
setb tr1 ;
mov dptr, #mydata1 ;
h1: clr a ;
movc a, @a+dptr ;
jz h2;-----------------------max delay and then display from 45h & 46h
acall send ;
inc dptr ;
sjmp h1 ;
send: mov sbuf, a ;
h3: jnb ti, h3 ;
clr ti ;
ret
h2: mov r2,#30
a1: mov r3,#255
a2: mov r4,#255
a3: djnz r4,a3
djnz r3,a2
djnz r2,a1
mov a,45h
acall datawrt
acall delay
mihir: sjmp mihir
;
har:
mov tmod, #20h ;
mov th1, #0fdh ;
mov scon, #50h ;
mov ie, #10010000b ;
setb tr1
h4: cpl p1.0;----------------------compliment led
clr ie.7;-------------------------disable interrupt
mov a,#00h
jb ti, trans ;
mov a, sbuf ;
;---------------------------------store the value A in to 45h
mov 45h,a
mov a,45h
acall datawrt
acall delay
mov 45h,#36h
;----------------------------------------------------------------
;next-------------- display the data from 45h in to LCD ( display for some time)
;load 45H= $
;return from interrupt
clr ri ;
reti ;
trans: clr ti ;
reti ;
comwrt: mov p2, a ;
clr p0.1 ;
setb p0.0 ;
acall delay ;
clr p0.0 ;
ret ;
datawrt:mov p2, a ;
setb p0.1 ;
setb p0.0 ;
acall delay ;
clr p0.0 ;
ret ;
delay: mov r3, #255 ;
here2: mov r4, #255 ;
here: djnz r4, here ;
djnz r3, here2 ;
ret
;
;
org 400H ;
mydata1:db 'AT',0dh,0 ;
end
Thank you.
_________________
NPES