| ??? 04/01/08 09:13 Read: times |
#152821 - interfacing 6210 and AT89S52 |
I am doing a project on SMS controller. I can send SMS via Hyperterminal using AT command, but have problems with sending it via AT89S52.
Below is my code, can anyone help me to find the problem? Thanks
;
ORG 0000H ; begins at ROM location 0000H
LJMP MAIN
;------------------------Main Program---------------------------------------
;
ORG 40H
MAIN: CLR P1.2 ;turn off LED
CLR P1.4 ;turn off Buzzer
SETB P2.0
SETB P2.3
SETB P2.6
JNB P2.0, START
JNB P2.3, TESTSHORTDELAY
JNB P2.6, TESTLONGDELAY
SJMP MAIN
;
START:
SETB P1.2 ;Turn on LED
SETB P1.4 ;Turn on Buzzer
ACALL SENDMSG ;Send MSG
ACALL LONGDELAY ;Delay for 5s
CLR P1.2 ;Turn off LED
CLR P1.4 ;Turn off Buzzer
SJMP MAIN
;-----------------------Send MSG--------------------------------------------
;
SENDMSG:
CALL SET_UART
CALL PHONEINT
MOV DPTR, #PDU_LENGTH
CALL GETCHAR
CALL RECEIVE_PROMPT
MOV DPTR, #PDU_CONTENT
CALL GETCHAR
RET
PHONEINT: MOV R5, 128
SENDU: MOV SBUF, #55H
CHECK: JNB TI,CHECK
CLR TI
DJNZ R5, SENDU
RET
SET_UART:
CLR TR1
CLR TI
CLR RI
MOV SCON, #01010010B
anl PCON, #07fh ;To make SMOD =0
MOV TMOD, #00100000B ; timer 1, mode 2 (auto reload)
MOV TH1, #0FDH
SETB TR1 ; Start timer 1
RET
GETCHAR:
CLR A
MOVC A, @A+DPTR
INC DPTR
JNZ SENDCHAR
RET
SENDCHAR:
CLR TI
MOV SBUF, A
JNB TI, $
RET
RECEIVE_PROMPT:
CALL SHORTDELAY ;wait for a moment
RET
;-----------------------------------TESTS----------------------------------------------------------
;
TESTSHORTDELAY:
SETB P1.2
CALL SHORTDELAY
CLR P1.2
LJMP MAIN
TESTLONGDELAY: SETB P1.2
CALL LONGDELAY
CLR P1.2
LJMP MAIN
TESTTRAN: CALL PHONEINT
LJMP MAIN
;-------------------------------------------Delay----------------------------------------------
;
LONGDELAY:
MOV R2, #50 ;~1S
S1: MOV R3, #250
S2: MOV R4, #250
DJNZ R4, $
DJNZ R3, S2
DJNZ R2, S1
RET
SHORTDELAY:
MOV R2, #10 ;~0.5S
S11: MOV R3, #200
S22: MOV R4, #200
DJNZ R4, $
DJNZ R3, S22
DJNZ R2, S11
RET
;------------------------On Chip Code Spce for Storing Data----------------------------------
;
ORG 250H
PDU_LENGTH:
DB "AT+CMGS=37",0DH,0AH, 00H
PDU_CONTENT:
DB "07915892945897F501000B915862806461F400001BF9775D0E1297D96FF739ED3ECF4161791914A683E4E9F91A", 1AH, 00H
END
|
| Topic | Author | Date |
| interfacing 6210 and AT89S52 | 01/01/70 00:00 | |
| what is the expected behaviour... | 01/01/70 00:00 | |
| Re: what is the expected behaviour... | 01/01/70 00:00 | |
| I am not sure. | 01/01/70 00:00 | |
| Names? Delays? | 01/01/70 00:00 | |
| Re: delay | 01/01/70 00:00 | |
| Maybe try ... | 01/01/70 00:00 | |
| connected to computer | 01/01/70 00:00 | |
problem solved | 01/01/70 00:00 |



