51單片機GPRS模塊(LT8030)匯編通訊程序
stack ends
DATA SEGMENT PARA PUBLIC DATA
WEN1 DB AT+IISP1=*99***1#,0DH,0AH,00H
WEN2 DB AT+IDNS1=211.136.18.171,0DH,0AH,00H
WEN3 DB AT+IUSRN=WAP,0DH,0AH,00H
WEN4 DB AT+IPWD=WAP,0DH,0AH,00H
WEN5 DB AT+IMIS="AT+CGDCONT=1,IP,CMNET",0DH,0AH,00H
WEN6 DB AT+IXRC=0,0DH,0AH,00H
WEN7 DB AT+IMTYP=2,0DH,0AH,00H
WEN8 DB AT+ISTCP:203.93.5.55,1024,0DH,0AH ;open a socket
WEN9 DB AT+ISSND%:,00H,00H,00H,, ;send data to a socket
WEN11 DB AT+ISST:XXX,0DH,0AH,00H ;socket stued
WEN12 DB AT+ISRCV:XXX,0DH,0AH,00H ;recived data
WEN13 DB AT+ISCLS:XXX,0DH,0AH,00 ;close socket
WEN16 DB I/, 00H,00H,00H,, ;XXX
WEN20 DB 256 DUP(0)
WEN30 DB d:MASMlink.EXE
WEN31 DB 30360 DUP(?)
WEN32 DB 8096:
WEN38 DB D120D120D120
WEN50 DB AT+IHSRV=203.93.5.55:1024,0DH,0AH
WEN51 DB AT+IDSTR=EEEEE,0DH,0AH,00H
WEN52 DB AT+ISTYP=0,0DH,0AH,00H
WEN53 DB AT+ISNSI="5,8,N,1,0",0DH,0AH,00H
WEN54 DB AT+IMCBF=1,0DH,0AH,00H
WEN55 DB AT+ISNMD,0DH,0AH,00H
WEN56 DB EEEEE,0DH,0AH,00H
WEN58 DB 2BH,2BH,2BH,0DH
WEN60 DB AT+I,0DH
DATA ENDS
code segment para public code
start proc far
tart: mov dx, 3fbh
INC DX
INC DX
NOP
NOP
NOP
NOP
NOP
RDSTS: MOV DX, 3FDH
TSDOK: MOV BX, offset WEN1 ;AT+IISP
TSDOK1: MOV CX, 22 ;receive many
IDNS1: MOV BX, OFFSET WEN2 ;AT+IDNS1
IUSRN: MOV BX, OFFSET WEN3 ;AT+IUSRN
ERR01: JMP ERR0
TSDOK2: MOV BX, OFFSET WEN4 ;AT+IPWD
IMIS: MOV BX, OFFSET WEN5 ;AT+IMIS
IXRC: MOV BX, OFFSET WEN6 ;AT+IXRC
IMTYP: MOV BX, OFFSET WEN7 ;AT+IMTYP
SNDTCP: MOV BX, OFFSET WEN8
READF: MOV AX, 3D00H
BUZADD: MOV SI, OFFSET WEN38
BUZAB: MOV AL, [SI]
SND1234:MOV BX, OFFSET WEN9
SNDHSR: MOV BX, OFFSET WEN50 ;AT+IHSRV
SNDSTR: MOV BX, OFFSET WEN51 ;AT+IDSTR
ISTYP: MOV BX, OFFSET WEN52 ;AT+ISTYP
ISNSI: MOV BX, OFFSET WEN53 ;AT+ISNSI
IMCBF: MOV BX, OFFSET WEN54 ;AT+IMCBF
ISNMD: MOV BX, OFFSET WEN55 ;AT+ISNMD
RSNDB: PUSH CX
RSND1: MOV BX, OFFSET WEN9
SNDMAP: MOV BX, OFFSET WEN31
SNDEEE: MOV BX, OFFSET WEN56
;ISST: MOV BX, OFFSET WEN11
; MOV DX, 12
; CALL TSCHR
; MOV CX, 18
; CALL RECVCHR
; MOV CX, 20
; CALL MKCHR
; NOP
;LKLK: MOV DX, 3FDH
; IN AL, DX
; TEST AL, 1EH
; JNZ LKLK
ANM: MOV CX, 40000
BNM: NOP
SNDCLS: PUSH CX
RRR: PUSH CX
RRR1: NOP
RRR2: POP CX
SNDAT: MOV DX, 5
ERR0: JMP ERR3
TSCHR PROC NEAR
TS: PUSH DX
TSO: MOV DX, 3FDH
YES: NOP
TSCHR ENDP
ERR3: JMP ERR1
RECVCHR PROC NEAR
RECV: MOV DL, CL
RECV1: PUSH DX
RECV2: MOV DX, 3FDH
PP0: MOV AL, 4BH
PP: RET
RECVCHR ENDP
RDSTS1: JMP RDSTS
ERR1: JMP ERR
MKCHR PROC NEAR
MK: PUSH AX
MK1: MOV BX, OFFSET WEN20
MK2: MOV AL, [BX]
MAD: MOV [BX], AL
MKCHR ENDP
KEY: MOV AH, 01
ERR: JMP ERROR
RDS: JMP RDSTS
;FS: MOV CX, 0200H
; MOV DX, [0082h]
; MOV AH, 3CH
; INT 21H
; MOV BX, AX
; MOV CX, 1024H
; MOV DX, data-seg MNMN
; mov ah, 3fh
; INT 21H
; NOP
; MOV CX, AX
; MOV BX, data-seg MNMN
;FS1: MOV DX, 3FDH
; IN AL, DX
; TEST AL, 1EH
; JNZ ERROR
;FS2: TEST AL, 01H
; NOP
; TEST AL, 02H
; JZ RDS
;FS3: MOV DX, 3F8H
; MOV AL, [BX]
; OUT DX, AL
; DEC BX
; LOOP FS1
; JMP RDSTS
ERROR: MOV DX, 3F8H
INT 10H
YS: MOV AH, 14
DISPCHR PROC NEAR
DISPCHR ENDP
SCAR PROC NEAR
SCA1: XOR AX, AX
SCA2: MOV CX, 5
SCA3: MOV AL, [SI]
SCA4: MOV CX, 3
SCA5: MOV AL, [SI]
SCA6: MOV CX, 3
SCA61: MOV AL, [SI]
SCA7: MOV CX, 3
SCA71: MOV AL, [SI]
SCA8: MOV CX, 3
SCA81: MOV AL, [SI]
SCA9: RET
SCAR ENDP
KCHR PROC NEAR
K: PUSH AX
K1: MOV BX, OFFSET WEN20
K2: MOV AL, [BX]
KCHR ENDP
TS1CHR PROC NEAR
TS1: PUSH DX
TSO1: MOV DX, 3FDH
YES1: NOP
TS1CHR ENDP
RCVCHR PROC NEAR
RCV: MOV DL, CL
RCV1: PUSH DX
RCV2: MOV DX, 3FDH
RPP0: MOV AL, 45H
RPP: RET
RCVCHR ENDP
START ENDP
CODE ENDS
END START
評論