ORG 0H
ACALL INT_LCD
MOV TMOD,#20H
MOV TH1,#-3
MOV SCON,#50H
SETB TR1
CLR RI
A_1: JNB RI,A_1
H_1: MOV DPTR,#MYDATA
D_1: CLR A
MOVC A,@A+DPTR
ACALL DATAWRT
ACALL DELAY
INC DPTR
JZ C_2
SJMP D_1
C_2: ACALL CLR_LCD
H_2: MOV DPTR,#MSG_1
D_2: CLR A
MOVC A,@A+DPTR
JZ B_2
ACALL SEND
INC DPTR
SJMP D_2
B_2: ACALL RECV
ACALL DATAWRT
ACALL DELAY
ACALL CLR_LCD
ACALL INT_LCD
H_3: MOV DPTR,#MSG_2
D_3: CLR A
MOVC A,@A+DPTR
JZ B_3
ACALL SEND
INC DPTR
SJMP D_3
B_3: ACALL RECV
ACALL DATAWRT
ACALL DELAY
ACALL CLR_LCD
ACALL INT_LCD
H_4: MOV DPTR,#MSG_3
D_4: CLR A
MOVC A,@A+DPTR
JZ B_4
ACALL SEND
INC DPTR
SJMP D_4
B_4: ACALL RECV
ACALL DATAWRT
ACALL DELAY
ACALL CLR_LCD
ACALL INT_LCD
H_5: MOV DPTR,#MYDATA
D_5: CLR A
MOVC A,@A+DPTR
ACALL DATAWRT
ACALL DELAY
INC DPTR
JZ AGAIN
SJMP D_5
AGAIN: ACALL DELAY
ACALL CLR_LCD
INT_LCD: MOV A,#38H
ACALL COMNWRT
ACALL DELAY
MOV A,#0EH
ACALL COMNWRT
ACALL DELAY
MOV A,#06H
ACALL COMNWRT
ACALL DELAY
RET
COMNWRT: MOV P1,A
CLR P0.0
SETB P0.1
ACALL DELAY
CLR P0.1
RET
DATAWRT: MOV P1,A
SETB P0.0
SETB P0.1
ACALL DELAY
CLR P0.1
RET
DELAY: MOV R0,#2
HERE3: MOV R3,#250
HERE2: MOV R4,#255
HERE: DJNZ R4,HERE
DJNZ R3,HERE2
DJNZ R0,HERE3
RET
SEND: MOV SBUF,A
PUT: JNB TI,PUT
CLR TI
RET
RECV: JNB RI,RECV
MOV A,SBUF
CLR RI
RET
CLR_LCD: MOV A,#01H
ACALL COMNWRT
ACALL DELAY
RET
ORG 300H
MYDATA: DB " HELLO ",0
MSG_1: DB "A",0
MSG_2: DB "AT",0
MSG_3: DB "AT+CMGF=1",0
END