微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机GPRS模块(LT8030)汇编通讯程序

51单片机GPRS模块(LT8030)汇编通讯程序

时间:11-28 来源:互联网 点击:
stack segment para stack stack

db 256 dup(0)

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

DB 16:123456abcdefghij,0DH,0AH,00H

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

assume cs: code,ds:data,ss:stack

mov ax, data

mov ds, ax

push dx

mov ax, 0

mov bx, 0

push ax

tart: mov dx, 3fbh

mov al, 80h

out dx, al

mov dx, 3f8h

mov AL, 00CH

OUT DX, AL

INC DX

MOV AX, 0H

OUT DX, AL

MOV DX, 3FBH

MOV AL, 00000011B

OUT DX, AL

INC DX

MOV AL, 00000011B

OUT DX, AL

MOV DX, 3F9H

MOV AL, 0H

OUT DX, AL

MOV BX, OFFSET WEN20+80

MOV AL, 0

MOV [BX], AL

;

NOP

NOP

NOP

NOP

NOP

RDSTS: MOV DX, 3FDH

IN AL, DX

TEST AL, 1EH

JNZ ERR01

TSDOK: MOV BX, offset WEN1 ;AT+IISP

MOV DX, 0019 ;send many

CALL TSCHR

TSDOK1: MOV CX, 22 ;receive many

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ TSDOK

MOV CX, 22

CALL MKCHR

IDNS1: MOV BX, OFFSET WEN2 ;AT+IDNS1

MOV DX, 25 ;send many

CALL TSCHR

MOV CX, 30 ;receive many

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ IDNS1

MOV CX, 21

CALL MKCHR

IUSRN: MOV BX, OFFSET WEN3 ;AT+IUSRN

MOV DX, 14 ;send many

CALL TSCHR

MOV CX, 18 ;receive many

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ IUSRN

MOV CX, 20

CALL MKCHR

JMP TSDOK2

ERR01: JMP ERR0

TSDOK2: MOV BX, OFFSET WEN4 ;AT+IPWD

MOV DX, 13 ;send many

CALL TSCHR

MOV CX, 20 ;receive many

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ TSDOK2

MOV CX, 20

CALL MKCHR

IMIS: MOV BX, OFFSET WEN5 ;AT+IMIS

MOV DX, 33

CALL TSCHR

MOV CX, 22

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ IMIS

MOV CX, 20

CALL MKCHR

IXRC: MOV BX, OFFSET WEN6 ;AT+IXRC

MOV DX, 10

CALL TSCHR

MOV CX, 15

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ IXRC

MOV CX, 13

CALL MKCHR

IMTYP: MOV BX, OFFSET WEN7 ;AT+IMTYP

MOV DX, 12

CALL TSCHR

MOV CX, 18

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ IMTYP

MOV CX, 18

CALL MKCHR

SNDTCP: MOV BX, OFFSET WEN8

MOV DX, 26 ;send many

CALL TSCHR

MOV CX, 22

CALL RECVCHR

MOV CX, 24

CALL KCHR

CALL SCAR

MOV CX, 1

CALL MKCHR

NOP

NOP

NOP

NOP

READF: MOV AX, 3D00H

MOV DX, OFFSET WEN30

INT 21H

MOV BX, AX

MOV AH, 3FH

MOV CX, 30360

MOV DX, OFFSET WEN31

INT 21H

MOV AH, 3EH

INT 21H

NOP

NOP

NOP

NOP

BUZADD: MOV SI, OFFSET WEN38

MOV DI, OFFSET WEN31

MOV CX, 0012

BUZAB: MOV AL, [SI]

MOV [DI], AL

INC SI

INC DI

DEC CX

JNZ BUZAB

NOP

NOP

SND1234:MOV BX, OFFSET WEN9

MOV DX, 33

CALL TSCHR

MOV CX, 18

CALL RECVCHR

MOV CX, 6

CALL MKCHR

SNDHSR: MOV BX, OFFSET WEN50 ;AT+IHSRV

MOV DX, 26

CALL TSCHR

MOV CX, 20

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ SNDHSR

MOV CX, 18

CALL MKCHR

SNDSTR: MOV BX, OFFSET WEN51 ;AT+IDSTR

MOV DX, 15

CALL TSCHR

MOV CX, 20

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

SUB AL, 4BH

JNZ SNDSTR

MOV CX, 18

CALL MKCHR

NOP

ISTYP: MOV BX, OFFSET WEN52 ;AT+ISTYP

MOV DX, 11

CALL TSCHR

MOV CX, 20

CALL RECVCHR

MOV BX, OFFSET WEN20+80

MOV AL, [BX]

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top