Discussion in "Embedded GSM Development" started by    ugoo5000    Apr 28, 2013.
Sun Apr 28 2013, 08:34 pm
#1
i am having difficulty in sending message through sim900 with at89c52. i have tried the following code but is not going. pls can some one help me. bellow is my code:
ORG 0000H
MOV P1,#0FFH
MOV P2,#0FFH


STARTUP:
JNB P2.0,START
JMP STARTUP

START:
clr p1.0
call delay2
setb p1.0
call delay
MOV TMOD,#20H ;//TIMER 1, MODE 2
MOV TH1,#-3 ;//9600 BAUD RATE
MOV SCON,#50H ;//8 BIT, 1 STOP, EN ENABLED
SETB TR1
ACALL DELAY
ACALL DELAY
ACALL DELAY
MOV DPTR,#MSG1
ACALL H1
ACALL DELAY
MOV DPTR,#MSG2
ACALL H1
ACALL DELAY

MOV DPTR,#MSG3
ACALL H1
ACALL DELAY
MOV DPTR,#MSG4
ACALL H1
ACALL DELAY
CLR P1.0
CALL DELAY2
SETB P1.0
CALL DELAY2
CLR P1.0
CALL DELAY2
SETB P1.0
CALL DELAY2
CLR P1.0
CALL DELAY2
SETB P1.0
CALL DELAY2
CLR P1.0
CALL DELAY2
SETB P1.0
CALL DELAY2
AJMP STARTUP


H1: CLR A
MOVC A,@A+DPTR
JZ B1
ACALL SEND
INC DPTR
SJMP H1
B1:
RET
SEND: MOV SBUF,A
H2: JNB TI,H2
CLR TI
RET
DELAY: MOV R3,#50H
HERE2: MOV R4,#50H
HERE: DJNZ R4,HERE
DJNZ R3,HERE2
RET


DELAY2:
MOV R0,#8
MOV R1,#125
MOV R2,#50
MOTION: DJNZ R2,MOTION
DJNZ R1,MOTION
DJNZ R0,MOTION
RET





ORG 300H
MSG1: DB "AT",0DH
DB 0H
MSG2: DB "AT+CMGF=1",0DH
DB 0H

MSG3: DB "AT+CMGS=",'"+2348039309417"',0DH
DB 0H
MSG4: DB "CHECK",0x1A
DB 0H

END
the program is design in a way that when p2.0 is set a bit then the code start sending the text to the number. it work on hypretaminal and in my proteus but didnt work in my hardware.
Mon Apr 29 2013, 10:27 am
#2
I have not gone through your code completely, Just had a quick look. Make sure you have good amount of delay between each command. and try to make change as shown

MSG3: DB "AT+CMGS=",'\"+2348039309417\"',0DH
Wed May 01 2013, 08:47 am
#3
were and were in the program will i put delay? and for how many times can i call this delay?
Wed May 01 2013, 11:06 am
#4
delay between each command should be around 1 sec. sorry but modems are slow
Fri May 03 2013, 04:53 pm
#5
please am having problem with interfacing sim900 with at89s52. already i have a program which i have tried on Proteus and is working but if i put it on hardware, it will not work. I use a delay of 1 sec in-between each AT command that i send. I attached both the program and the Proteus zip file bellow.
Sat May 04 2013, 12:31 pm
#6
I do not find anything wrong with program.. make sure your modem is on before you run your program. just try making this change and see.

MSG4: DB "AT+CMGS=\"+2348039309417\"",0DH
Sat May 04 2013, 12:49 pm
#7

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm