;VEHICLE TRACKING REQUEST
;P2.0 =BUZZER
;P2.1 =MOTOR
;P2.3 =
;P2.4 =
;P0 = DISP DATA
;P2.7 = RS
;P2.6 = R/W
;P2.5 = EN
TXD MACRO
JNB TI,$
CLR TI
MOV SBUF,R6
MACEND
RXD MACRO
JNB RI,$
CLR RI
MOV R7,SBUF
MACEND
ORG 0
LJMP START
ORG 0050H
START: MOV P2,#00H
LCALL SPINI
LCALL LCDINI
LCALL DEL
MOV DPTR,#0900H
LCALL TLINE
MOV DPTR,#0910H
LCALL BLINE
LCALL SSEC
; MOV DPTR,#0920H
; LCALL TLINE
; MOV DPTR,#0930H
; LCALL BLINE
SETB P1.5
LCALL SSEC
XX2: ; JNB P1.0,XX2
; LCALL DEL
; JNB P1.0,XX2
; SETB P2.1
; MOV 19H,#01H
LJMP SMSRX
;*********** SMS TXD *********
SMSX:
MOV DPTR,#09A0H
LCALL TLINE
MOV DPTR,#09B0H
LCALL BLINE
LCALL GPSREAD
LCALL DISPLL
SETB P1.5
LCALL SSEC
MOV DPTR,#0940H
LCALL TLINE
MOV DPTR,#0950H
LCALL BLINE
LCALL SSEC
;-------------------
MOV 3EH,#03H
;------------------------
SMSXX: MOV DPTR,#AT_CMGF ;SMS MODE PDU=0/TEXT=1
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC3
MOV DPTR,#AT_ERS ;ERASE OF 1 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC3
MOV DPTR,#AT_CPMS ;SIMM MEMORY SELECTION
MOV R2,#0CH
LCALL CMD1
LCALL ENTER
LCALL SEC3 ;BETTER TO PUT ERASE
;---------3 NUMBERS -----------
MOV A,3EH
CJNE A,#03H,NP2
MOV DPTR,#AT_CMGW
LJMP NP4
NP2: CJNE A,#02H,NP3
MOV DPTR,#AT_CMGW2
LJMP NP4
NP3: CJNE A,#01H,NP4
MOV DPTR,#AT_CMGW3 ;WRITE MES.IN SIMM MEMORY LOCATION
NP4: MOV R2,#14H
LCALL CMD1
LCALL ENTER
;-----------------------------------
LCALL SEC3
;MOV DPTR,#AT_CMD ;WRITE MES.IN SIMM MEMORY LOCATION
;MOV R2,#0BH
;LCALL CMD1
MOV A,19H
CJNE A,#01H,NXMES2
LCALL CMDRAM1
LJMP NXMES5
NXMES2:CJNE A,#02H,NXMES3
LCALL CMDRAM2
LJMP NXMES5
NXMES3:CJNE A,#03H,NXMES4
JB P1.0,OLOL
LCALL CMDRAM3
LJMP NXMES5
OLOL: LCALL CMDRAM4
LJMP NXMES5
NXMES4:CJNE A,#04H,NXMES5
LCALL CMDRAM4
NXMES5: LCALL SEC3
MOV DPTR,#AT_CMSS ;SEND COMMAND TO MODEM
MOV R2,#09H
LCALL CMD1
LCALL ENTER
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC3
DEC 3EH
MOV A,3EH
CJNE A,#00H,SMS123
MOV DPTR,#0960H
LCALL TLINE
MOV DPTR,#0970H
LCALL BLINE
LCALL SEC3
LJMP SMSRX
SMS123: LJMP SMSXX
;*******************************************
SMSRX:
MOV DPTR,#0980H
LCALL TLINE
MOV DPTR,#0990H
LCALL BLINE
LCALL SEC3
MOV DPTR,#AT_ERS ;ERASE OF 1 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS2 ;ERASE OF 2 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS3 ;ERASE OF 3 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS4 ;ERASE OF 4 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS5 ;ERASE OF 5 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
;---------------------
MOV DPTR,#AT_CMGF ;SMS MODE PDU=0/TEXT=1
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC
MOV DPTR,#AT_CNMI ;REQ. FOR RECEIVE
MOV R2,#11H
LCALL CMD1
LCALL ENTER
LCALL SEC
MOV DPTR,#AT_CNMA ;READY TO RECEIVE
MOV R2,#07H
LCALL CMD1
LCALL ENTER
LCALL SEC3
LCALL SEC
CLR P2.0
;********************************
MAIN: MOV R0,#20H
NXTB: LCALL RXD
CJNE R4,#01H,NXTBZ
MOV A,R1
MOV @R0,A
INC R0
CJNE R0,#57H,NXTB
LCALL DISP
LCALL DEV1ON
LCALL DEV1OF
LCALL SEC3
MOV A,19H
CJNE A,#00H,NXSMS
LJMP SMSRX
NXSMS: LJMP SMSX
NXTBZ: CJNE R4,#03H,NXTB
MOV 19H,#04H ;ACC
CLR P2.1
SETB P2.0
LJMP SMSX
;************************************
DEV1ON:
MOV A,54H
CJNE A,#'P',MRET1
MOV A,55H
CJNE A,#'O',MRET1
MOV A,56H
CJNE A,#'S',MRET1
SETB P2.1
MOV 19H,#02H
RET
MRET1: MOV 19H,#00H
RET
;--------------------------------
DEV1OF:
MOV A,54H
CJNE A,#'P',NRET1
MOV A,55H
CJNE A,#'T',NRET1
MOV A,56H
CJNE A,#'M',NRET1
CLR P2.1
SETB P2.0
MOV 19H,#03H
RET
NRET1: RET
;************************************
RXD: MOV R4,#00H
MOV R7,#1FH
AE: MOV R6,#FFH
AD: MOV R5,#FFH
AB: JNB P1.2,LSEN ;VIBRATION SENSOR
JNB RI,AC
CLR RI
MOV R1,SBUF
MOV R4,#01H ;STATUS CHK #01 OK,#02 NOT OK
;MOV R6,SBUF
;TXD
RET
AC: DJNZ R5,AC
DJNZ R6,AD
DJNZ R7,AE
MOV R4,#02H
RET
;-----------------------------
LSEN: MOV R0,#FFH
DJNZ R0,$
JB P1.2,AC
MOV R4,#03H
RET
;*************LOCATION SENSING***********
LDISP:
RET
;****************************************
DISP:
CLR p2.7
CLR p2.6
MOV P0,#C0H
LCALL WRI
MOV R1,#54H
XTKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#57H,XTKL
LCALL BEEP2
RET
;********** LCD INI *************************
LCDINI:
CLR P2.5
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#38H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#02H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#0CH
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#1CH
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#38H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#06H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
RET
;----------------------------
TLINE: CLR p2.7
CLR p2.6
MOV P0,#80H
LCALL WRI
MOV R7,#00H
TKL:
CLR A
MOVC A,@A+DPTR
MOV P0,A
LCALL WRD
INC DPTR
INC R7
CJNE R7,#10H,TKL
RET
BLINE: CLR p2.7
CLR p2.6
MOV P0,#C0H
LCALL WRI
MOV R7,#00H
BKL:
CLR A
MOVC A,@A+DPTR
MOV P0,A
LCALL WRD
INC DPTR
INC R7
CJNE R7,#10H,BKL
RET
;******** INSTRUCTION /DATA WRITE *********
WRI: SETB P2.5
MOV R0,#FFH
DJNZ R0,$
CLR P2.5
MOV R0,#FFH
DJNZ R0,$
RET
WRD: SETB p2.7 ; REGISTER
CLR p2.6 ;READ WRITE
SETB P2.5 ;ENABLE
MOV R0,#FFH
DJNZ R0,$
CLR P2.5
CLR p2.6
CLR p2.7
RET
;******************************
DEL: MOV R7,#FFH
DJNZ R7,$
RET
DEL1: MOV R7,#FFH
DJNZ R7,$
RET
SEC: MOV R5,#03H
M1: MOV R6,#FFH
M2: MOV R7,#FFH
M3: DJNZ R7,M3
DJNZ R6,M2
DJNZ R5,M1
RET
SEC3: MOV R5,#16H
M13: MOV R6,#FFH
M23: MOV R7,#FFH
M33: DJNZ R7,M33
DJNZ R6,M23
DJNZ R5,M13
RET
SSEC: MOV R5,#1FH
SM1: MOV R6,#FFH
SM2: MOV R7,#FFH
SM3: DJNZ R7,SM3
DJNZ R6,SM2
DJNZ R5,SM1
RET
;********************************************
XDEL:
mov r4,#0FH
djnz r4,$
RET
XDEL1: mov r4,#0FH
djnz r4,$
RET
XDEL2: MOV R2,#5FH
GB: mov r0,#FFH
djnz r0,$
DJNZ R2,GB
RET
;*********** DISPLAY *************
BEEP2:
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC
RET
;**********************************************
ENTER: MOV R6,#0DH
TXD
RET
CMD1: CLR A
MOVC A,@A+DPTR
MOV R6,A
TXD
INC DPTR
DJNZ R2,CMD1
RET
;----------SENDING MES.-----------
CMDRAM1:MOV DPTR,#AT_CMD
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM2:MOV DPTR,#AT_CMD2
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM3:MOV DPTR,#AT_CMD3
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM4:MOV DPTR,#AT_CMD4
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
GPSTX:
MOV R1,#30H
NEXT11: CLR A
MOV A,@R1
MOV R6,A
TXD
INC R1
CJNE R1,#70H,NEXT11
MOV R6,#20H
TXD
MOV R6,#20H
TXD
MOV R6,#1AH
TXD
RET
;*****************************************
GPSREAD:
LCALL SPINI2
LCALL SEC
LCALL SEC
CLR P1.5
LCALL SEC
NRD: RXD
;------------
CJNE R7,#24H,NRD
MOV R0,#30H
NRDX: RXD
MOV A,R7
MOV @R0,A
INC R0
CJNE A,#0AH,NRDX
CLR P2.3
MOV A,32H ;VERIFICATION FOR GGA
CJNE A,#47H,ERRSIG
MOV A,33H
CJNE A,#47H,ERRSIG
MOV A,34H
CJNE A,#41H,ERRSIG
;CLR P2.2
LCALL SEC
LCALL SEC
LCALL SPINI
GPSRET: SETB P2.4
SETB P1.5
LCALL SPINI
LCALL SEC
RET
;------------
ERRSIG: ;CLR P2.2
;LCALL SEC
SETB P2.3
LJMP NRD
;****************************************************
DISPLL: MOV DPTR,#09C0H
LCALL TLINE
MOV DPTR,#09D0H
LCALL BLINE
CLR p2.7
CLR p2.6
MOV P0,#84H
LCALL WRI
MOV R1,#41H
RTKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#4CH,RTKL
;------------
CLR p2.7
CLR p2.6
MOV P0,#C4H
LCALL WRI
MOV R1,#4DH
RBKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#59H,RBKL
LCALL SEC3
RET
;*******************************************
;************** UART PORT INT *************
SPINI:
MOV A,#00H
MOV TCON,#40H
MOV TMOD,#20H
MOV SCON,#52H
MOV IE,#9AH
MOV TH1,#FDH
MOV TL1,#FDH
RET
SPINI2:
MOV A,#00H
MOV TCON,#40H
MOV TMOD,#20H
MOV SCON,#52H
MOV IE,#9AH
MOV TH1,#FDH
MOV TL1,#FDH
RET
;##############################
ORG 0900H
;************ 1 LINE
DB 'VEHICLE TRACKING '
DB 'USING GPS SYSTEM'
DB 'WAITING FOR '
DB 'DOOR OPEN.... '
DB ' SMS SENDING.. '
DB ' '
DB ' SMS SENT OK.. '
DB ' '
DB 'SMS RECEIVING.. '
DB ' '
DB 'GPS READING... '
DB ' '
DB 'LAN: '
DB 'LAT: '
;*********************************
ORG 1B00H
AT_CMGF: DB "AT+CMGF=1"
ORG 1B20H
AT_CPMS: DB "AT+CPMS="
DB 22H
DB "SM"
DB 22H
ORG 1B40H
AT_CMGW: DB "AT+CMGS="
DB 22H
DB "1234567890" ;3rd sms
DB 22H
ORG 1B60H
AT_CMD: DB "VEHICLE TRACK AT"
DB 1AH
ORG 1BA0H
AT_CMSS: DB "AT+CMSS=1"
ORG 1BC0H
AT_D: DB "ATD098764312;"
ORG 1C00H
AT_ERS: DB "AT+CMGD=1"
ORG 1C10H
AT_ERS2: DB "AT+CMGD=2"
ORG 1C20H
AT_ERS3: DB "AT+CMGD=3"
ORG 1C30H
AT_ERS4: DB "AT+CMGD=4"
ORG 1C40H
AT_ERS5: DB "AT+CMGD=5"
ORG 1C50H
AT_CNMI: DB "AT+CNMI=2,2,0,0,0"
ORG 1C70H
AT_CNMA: DB "AT+CNMA"
ORG 1C80H ;2ND SMS
AT_CMGW2:DB "AT+CMGS="
DB 22H
DB "9398173868"
DB 22H
ORG 1CA0H ;1st SMS
AT_CMGW3:DB "AT+CMGS="
DB 22H
DB "12309873465"
DB 22H
AT_CMD2: DB "ANIMAL IS AT: "
DB 1AH
AT_CMD3: DB "TEMP. IS HIGH "
DB 1AH
AT_CMD4: DB " TEMP IS LOW. "
DB 1AH
END;
;AAAAAAAAAAAAA---------------FINAL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
RAJANI
Permalink;ANIMAL TRACKING REQUEST
;P2.0 =BUZZER
;P2.1 =MOTOR
;P2.3 =
;P2.4 =
;P0 = DISP DATA
;P2.7 = RS
;P2.6 = R/W
;P2.5 = EN
TXD MACRO
JNB TI,$
CLR TI
MOV SBUF,R6
MACEND
RXD MACRO
JNB RI,$
CLR RI
MOV R7,SBUF
MACEND
ORG 0
LJMP START
ORG 0050H
START: MOV P2,#00H
LCALL SPINI
LCALL LCDINI
LCALL DEL
MOV DPTR,#0900H
LCALL TLINE
MOV DPTR,#0910H
LCALL BLINE
LCALL SSEC
; MOV DPTR,#0920H
; LCALL TLINE
; MOV DPTR,#0930H
; LCALL BLINE
SETB P1.5
LCALL SSEC
XX2: ; JNB P1.0,XX2
; LCALL DEL
; JNB P1.0,XX2
; SETB P2.1
; MOV 19H,#01H
LJMP SMSRX
;*********** SMS TXD *********
SMSX:
MOV DPTR,#09A0H
LCALL TLINE
MOV DPTR,#09B0H
LCALL BLINE
LCALL GPSREAD
LCALL DISPLL
SETB P1.5
LCALL SSEC
MOV DPTR,#0940H
LCALL TLINE
MOV DPTR,#0950H
LCALL BLINE
LCALL SSEC
;-------------------
MOV 3EH,#03H
;------------------------
SMSXX: MOV DPTR,#AT_CMGF ;SMS MODE PDU=0/TEXT=1
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC3
MOV DPTR,#AT_ERS ;ERASE OF 1 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC3
MOV DPTR,#AT_CPMS ;SIMM MEMORY SELECTION
MOV R2,#0CH
LCALL CMD1
LCALL ENTER
LCALL SEC3 ;BETTER TO PUT ERASE
;---------3 NUMBERS -----------
MOV A,3EH
CJNE A,#03H,NP2
MOV DPTR,#AT_CMGW
LJMP NP4
NP2: CJNE A,#02H,NP3
MOV DPTR,#AT_CMGW2
LJMP NP4
NP3: CJNE A,#01H,NP4
MOV DPTR,#AT_CMGW3 ;WRITE MES.IN SIMM MEMORY LOCATION
NP4: MOV R2,#14H
LCALL CMD1
LCALL ENTER
;-----------------------------------
LCALL SEC3
;MOV DPTR,#AT_CMD ;WRITE MES.IN SIMM MEMORY LOCATION
;MOV R2,#0BH
;LCALL CMD1
MOV A,19H
CJNE A,#01H,NXMES2
LCALL CMDRAM1
LJMP NXMES5
NXMES2:CJNE A,#02H,NXMES3
LCALL CMDRAM2
LJMP NXMES5
NXMES3:CJNE A,#03H,NXMES4
JB P1.0,OLOL
LCALL CMDRAM3
LJMP NXMES5
OLOL: LCALL CMDRAM4
LJMP NXMES5
NXMES4:CJNE A,#04H,NXMES5
LCALL CMDRAM4
NXMES5: LCALL SEC3
MOV DPTR,#AT_CMSS ;SEND COMMAND TO MODEM
MOV R2,#09H
LCALL CMD1
LCALL ENTER
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC3
DEC 3EH
MOV A,3EH
CJNE A,#00H,SMS123
MOV DPTR,#0960H
LCALL TLINE
MOV DPTR,#0970H
LCALL BLINE
LCALL SEC3
LJMP SMSRX
SMS123: LJMP SMSXX
;*******************************************
SMSRX:
MOV DPTR,#0980H
LCALL TLINE
MOV DPTR,#0990H
LCALL BLINE
LCALL SEC3
MOV DPTR,#AT_ERS ;ERASE OF 1 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS2 ;ERASE OF 2 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS3 ;ERASE OF 3 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS4 ;ERASE OF 4 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
MOV DPTR,#AT_ERS5 ;ERASE OF 5 ST LOCATION
MOV R2,#09H
LCALL CMD1
LCALL ENTER
;---------------------
MOV DPTR,#AT_CMGF ;SMS MODE PDU=0/TEXT=1
MOV R2,#09H
LCALL CMD1
LCALL ENTER
LCALL SEC
MOV DPTR,#AT_CNMI ;REQ. FOR RECEIVE
MOV R2,#11H
LCALL CMD1
LCALL ENTER
LCALL SEC
MOV DPTR,#AT_CNMA ;READY TO RECEIVE
MOV R2,#07H
LCALL CMD1
LCALL ENTER
LCALL SEC3
LCALL SEC
CLR P2.0
;********************************
MAIN: MOV R0,#20H
NXTB: LCALL RXD
CJNE R4,#01H,NXTBZ
MOV A,R1
MOV @R0,A
INC R0
CJNE R0,#57H,NXTB
LCALL DISP
LCALL DEV1ON
LCALL DEV1OF
LCALL SEC3
MOV A,19H
CJNE A,#00H,NXSMS
LJMP SMSRX
NXSMS: LJMP SMSX
NXTBZ: CJNE R4,#03H,NXTB
MOV 19H,#04H ;ACC
CLR P2.1
SETB P2.0
LJMP SMSX
;************************************
DEV1ON:
MOV A,54H
CJNE A,#'P',MRET1
MOV A,55H
CJNE A,#'O',MRET1
MOV A,56H
CJNE A,#'S',MRET1
SETB P2.1
MOV 19H,#02H
RET
MRET1: MOV 19H,#00H
RET
;--------------------------------
DEV1OF:
MOV A,54H
CJNE A,#'P',NRET1
MOV A,55H
CJNE A,#'T',NRET1
MOV A,56H
CJNE A,#'M',NRET1
CLR P2.1
SETB P2.0
MOV 19H,#03H
RET
NRET1: RET
;************************************
RXD: MOV R4,#00H
MOV R7,#1FH
AE: MOV R6,#FFH
AD: MOV R5,#FFH
AB: JNB P1.2,LSEN ;VIBRATION SENSOR
JNB RI,AC
CLR RI
MOV R1,SBUF
MOV R4,#01H ;STATUS CHK #01 OK,#02 NOT OK
;MOV R6,SBUF
;TXD
RET
AC: DJNZ R5,AC
DJNZ R6,AD
DJNZ R7,AE
MOV R4,#02H
RET
;-----------------------------
LSEN: MOV R0,#FFH
DJNZ R0,$
JB P1.2,AC
MOV R4,#03H
RET
;*************LOCATION SENSING***********
LDISP:
RET
;****************************************
DISP:
CLR p2.7
CLR p2.6
MOV P0,#C0H
LCALL WRI
MOV R1,#54H
XTKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#57H,XTKL
LCALL BEEP2
RET
;********** LCD INI *************************
LCDINI:
CLR P2.5
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#30H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#38H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#02H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#0CH
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#1CH
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#38H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#06H
LCALL WRI
CLR p2.7
CLR p2.6
MOV P0,#01H
LCALL WRI
RET
;----------------------------
TLINE: CLR p2.7
CLR p2.6
MOV P0,#80H
LCALL WRI
MOV R7,#00H
TKL:
CLR A
MOVC A,@A+DPTR
MOV P0,A
LCALL WRD
INC DPTR
INC R7
CJNE R7,#10H,TKL
RET
BLINE: CLR p2.7
CLR p2.6
MOV P0,#C0H
LCALL WRI
MOV R7,#00H
BKL:
CLR A
MOVC A,@A+DPTR
MOV P0,A
LCALL WRD
INC DPTR
INC R7
CJNE R7,#10H,BKL
RET
;******** INSTRUCTION /DATA WRITE *********
WRI: SETB P2.5
MOV R0,#FFH
DJNZ R0,$
CLR P2.5
MOV R0,#FFH
DJNZ R0,$
RET
WRD: SETB p2.7 ; REGISTER
CLR p2.6 ;READ WRITE
SETB P2.5 ;ENABLE
MOV R0,#FFH
DJNZ R0,$
CLR P2.5
CLR p2.6
CLR p2.7
RET
;******************************
DEL: MOV R7,#FFH
DJNZ R7,$
RET
DEL1: MOV R7,#FFH
DJNZ R7,$
RET
SEC: MOV R5,#03H
M1: MOV R6,#FFH
M2: MOV R7,#FFH
M3: DJNZ R7,M3
DJNZ R6,M2
DJNZ R5,M1
RET
SEC3: MOV R5,#16H
M13: MOV R6,#FFH
M23: MOV R7,#FFH
M33: DJNZ R7,M33
DJNZ R6,M23
DJNZ R5,M13
RET
SSEC: MOV R5,#1FH
SM1: MOV R6,#FFH
SM2: MOV R7,#FFH
SM3: DJNZ R7,SM3
DJNZ R6,SM2
DJNZ R5,SM1
RET
;********************************************
XDEL:
mov r4,#0FH
djnz r4,$
RET
XDEL1: mov r4,#0FH
djnz r4,$
RET
XDEL2: MOV R2,#5FH
GB: mov r0,#FFH
djnz r0,$
DJNZ R2,GB
RET
;*********** DISPLAY *************
BEEP2:
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC
SETB P2.0
LCALL SEC
CLR P2.0
LCALL SEC
RET
;**********************************************
ENTER: MOV R6,#0DH
TXD
RET
CMD1: CLR A
MOVC A,@A+DPTR
MOV R6,A
TXD
INC DPTR
DJNZ R2,CMD1
RET
;----------SENDING MES.-----------
CMDRAM1:MOV DPTR,#AT_CMD
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM2:MOV DPTR,#AT_CMD2
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM3:MOV DPTR,#AT_CMD3
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
CMDRAM4:MOV DPTR,#AT_CMD4
MOV R2,#10H
LCALL CMD1
LJMP GPSTX
RET
GPSTX:
MOV R1,#30H
NEXT11: CLR A
MOV A,@R1
MOV R6,A
TXD
INC R1
CJNE R1,#70H,NEXT11
MOV R6,#20H
TXD
MOV R6,#20H
TXD
MOV R6,#1AH
TXD
RET
;*****************************************
GPSREAD:
LCALL SPINI2
LCALL SEC
LCALL SEC
CLR P1.5
LCALL SEC
NRD: RXD
;------------
CJNE R7,#24H,NRD
MOV R0,#30H
NRDX: RXD
MOV A,R7
MOV @R0,A
INC R0
CJNE A,#0AH,NRDX
CLR P2.3
MOV A,32H ;VERIFICATION FOR GGA
CJNE A,#47H,ERRSIG
MOV A,33H
CJNE A,#47H,ERRSIG
MOV A,34H
CJNE A,#41H,ERRSIG
;CLR P2.2
LCALL SEC
LCALL SEC
LCALL SPINI
GPSRET: SETB P2.4
SETB P1.5
LCALL SPINI
LCALL SEC
RET
;------------
ERRSIG: ;CLR P2.2
;LCALL SEC
SETB P2.3
LJMP NRD
;****************************************************
DISPLL: MOV DPTR,#09C0H
LCALL TLINE
MOV DPTR,#09D0H
LCALL BLINE
CLR p2.7
CLR p2.6
MOV P0,#84H
LCALL WRI
MOV R1,#41H
RTKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#4CH,RTKL
;------------
CLR p2.7
CLR p2.6
MOV P0,#C4H
LCALL WRI
MOV R1,#4DH
RBKL:
CLR A
MOV A,@R1
MOV P0,A
LCALL WRD
INC R1
CJNE R1,#59H,RBKL
LCALL SEC3
RET
;*******************************************
;************** UART PORT INT *************
SPINI:
MOV A,#00H
MOV TCON,#40H
MOV TMOD,#20H
MOV SCON,#52H
MOV IE,#9AH
MOV TH1,#FDH
MOV TL1,#FDH
RET
SPINI2:
MOV A,#00H
MOV TCON,#40H
MOV TMOD,#20H
MOV SCON,#52H
MOV IE,#9AH
MOV TH1,#FDH
MOV TL1,#FDH
RET
;##############################
ORG 0900H
;************ 1 LINE
DB 'ANIMAL TRACKING '
DB 'USING GPS SYSTEM'
DB 'WAITING FOR '
DB 'DOOR OPEN.... '
DB ' SMS SENDING.. '
DB ' '
DB ' SMS SENT OK.. '
DB ' '
DB 'SMS RECEIVING.. '
DB ' '
DB 'GPS READING... '
DB ' '
DB 'LAN: '
DB 'LAT: '
;*********************************
ORG 1B00H
AT_CMGF: DB "AT+CMGF=1"
ORG 1B20H
AT_CPMS: DB "AT+CPMS="
DB 22H
DB "SM"
DB 22H
ORG 1B40H
AT_CMGW: DB "AT+CMGS="
DB 22H
DB "8074920088" ;3rd sms
DB 22H
ORG 1B60H
AT_CMD: DB "VEHICLE TRACK AT"
DB 1AH
ORG 1BA0H
AT_CMSS: DB "AT+CMSS=1"
ORG 1BC0H
AT_D: DB "ATD9491896606;"
ORG 1C00H
AT_ERS: DB "AT+CMGD=1"
ORG 1C10H
AT_ERS2: DB "AT+CMGD=2"
ORG 1C20H
AT_ERS3: DB "AT+CMGD=3"
ORG 1C30H
AT_ERS4: DB "AT+CMGD=4"
ORG 1C40H
AT_ERS5: DB "AT+CMGD=5"
ORG 1C50H
AT_CNMI: DB "AT+CNMI=2,2,0,0,0"
ORG 1C70H
AT_CNMA: DB "AT+CNMA"
ORG 1C80H ;2ND SMS
AT_CMGW2:DB "AT+CMGS="
DB 22H
DB "9398173868"
DB 22H
ORG 1CA0H ;1st SMS
AT_CMGW3:DB "AT+CMGS="
DB 22H
DB "6304797293"
DB 22H
AT_CMD2: DB "ANIMAL IS AT: "
DB 1AH
AT_CMD3: DB "TEMP. IS HIGH "
DB 1AH
AT_CMD4: DB " TEMP IS LOW. "
DB 1AH
END;
;AAAAAAAAAAAAA---------------FINAL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- Log in or register to post comments
Joined March 13, 2019 2Wednesday at 11:10 AM