色婷婷AⅤ一区二区三区|亚洲精品第一国产综合亚AV|久久精品官方网视频|日本28视频香蕉

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 51單片機GPRS模塊(LT8030)匯編通訊程序

          51單片機GPRS模塊(LT8030)匯編通訊程序

          作者: 時間:2016-11-28 來源:網(wǎng)絡(luò) 收藏
          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]
          SUB AL, 4BH
          JNZ ISTYP
          MOV CX, 18
          CALL MKCHR
          ISNSI: MOV BX, OFFSET WEN53 ;AT+ISNSI
          MOV DX, 21
          CALL TSCHR
          MOV CX, 22
          CALL RECVCHR
          MOV BX, OFFSET WEN20+80
          MOV AL, [BX]
          SUB AL, 4BH
          JNZ ISNSI
          MOV CX, 18
          CALL MKCHR
          IMCBF: MOV BX, OFFSET WEN54 ;AT+IMCBF
          MOV DX, 11
          CALL TSCHR
          MOV CX, 22
          CALL RECVCHR
          MOV BX, OFFSET WEN20+80
          MOV AL, [BX]
          SUB AL, 4BH
          JNZ IMCBF
          MOV CX, 18
          CALL MKCHR
          NOP
          ISNMD: MOV BX, OFFSET WEN55 ;AT+ISNMD
          MOV DX, 9
          CALL TSCHR
          MOV CX, 22
          CALL RECVCHR
          MOV BX, OFFSET WEN20+80
          MOV AL, [BX]
          SUB AL, 4BH
          JNZ ISNMD
          MOV CX, 18
          CALL MKCHR
          NOP
          NOP
          MOV CX, 1
          RSNDB: PUSH CX
          NOP
          RSND1: MOV BX, OFFSET WEN9
          MOV DX, 33
          CALL TSCHR
          NOP
          POP CX
          LOOP RSNDB
          NOP
          SNDMAP: MOV BX, OFFSET WEN31
          MOV DX, 28096
          CALL TSCHR
          NOP
          NOP
          NOP
          NOP
          SNDEEE: MOV BX, OFFSET WEN56
          MOV DX, 5
          CALL TSCHR
          ;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
          NOP
          NOP
          ANM: MOV CX, 40000
          BNM: NOP
          NOP
          LOOP BNM
          NOP
          MOV CX, 10
          SNDCLS: PUSH CX
          MOV BX, OFFSET WEN58
          MOV DX, 3
          CALL TSCHR
          MOV CX, 10
          RRR: PUSH CX
          MOV CX, 60000
          RRR1: NOP
          NOP
          LOOP RRR1
          RRR2: POP CX
          NOP
          LOOP RRR
          POP CX
          LOOP SNDCLS
          SNDAT: MOV DX, 5
          MOV BX, OFFSET WEN60
          CALL TSCHR
          MOV CX, 11
          MOV BX, OFFSET WEN20
          CALL RCVCHR
          MOV CX, 12
          MOV BX, OFFSET WEN20
          CALL MKCHR
          NOP
          JMP KEY
          NOP
          JMP KEY
          ERR0: JMP ERR3
          TSCHR PROC NEAR
          TS: PUSH DX
          TSO: MOV DX, 3FDH
          IN AL, DX
          TEST AL, 20H
          JZ TSO
          MOV DX, 3F8H
          MOV AL, [BX]
          OUT DX, AL
          MOV CX, 200
          YES: NOP
          NOP
          LOOP YES
          INC BX
          POP DX
          DEC DX
          JNE TS
          RET
          TSCHR ENDP
          ERR3: JMP ERR1
          NOP
          RECVCHR PROC NEAR
          RECV: MOV DL, CL
          MOV BX, OFFSET WEN20
          RECV1: PUSH DX
          RECV2: MOV DX, 3FDH
          IN AL, DX
          TEST AL, 01H
          JZ RECV2
          MOV DX, 3F8H
          IN AL, DX
          MOV [BX], AL
          INC BX
          POP DX
          DEC DL
          JZ PP
          SUB AL, 4BH
          JZ PP0
          LOOP RECV1
          JMP PP
          PP0: MOV AL, 4BH
          MOV BX, OFFSET WEN20+80
          MOV [BX], AL
          PP: RET
          RECVCHR ENDP
          RDSTS1: JMP RDSTS
          ERR1: JMP ERR
          MKCHR PROC NEAR
          MK: PUSH AX
          PUSH bx
          PUSH DX
          MK1: MOV BX, OFFSET WEN20
          MK2: MOV AL, [BX]
          PUSH BX
          AND AL, 7FH
          MOV BX, 0
          MOV AH, 14
          INT 10H
          POP BX
          INC BX
          LOOP MK2
          MOV CX, 85
          MOV BX, OFFSET WEN20
          MOV AL, 2EH
          MAD: MOV [BX], AL
          INC BX
          LOOP MAD
          MOV AL, 0AH
          MOV AH, 14
          MOV BX, 0
          INT 10H
          POP DX
          POP BX
          POP AX
          RET
          MKCHR ENDP
          KEY: MOV AH, 01
          INT 16H
          JZ KEY
          MOV AH, 0
          INT 16H
          CMP AL, 0DH
          JNZ RDSTS1
          MOV AL, 0AH
          MOV BX, 0
          MOV AH, 14
          INT 10H
          MOV AX, 4C00H
          INT 21H
          RET
          ERR: JMP ERROR
          RDS: JMP RDSTS
          NOP
          ;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
          IN AL, DX
          MOV AL, "?"
          MOV AH, 14
          MOV BX, 0
          INT 10H
          MOV CX, 1
          MOV DX, 3FDH
          IN AL, DX
          YS: MOV AH, 14
          INT 10H
          LOOP YS
          MOV AL, 0AH
          MOV AH, 14
          MOV BX, 0
          INT 10H
          JMP RDSTS
          DISPCHR PROC NEAR
          PUSH BX
          MOV BX, 0
          MOV AH, 14
          INT 10H
          POP BX
          RET
          DISPCHR ENDP
          SCAR PROC NEAR
          PUSH BX
          MOV CX, 40
          MOV BX, OFFSET WEN20
          SCA1: XOR AX, AX
          MOV AL, [BX]
          SUB AL, 49H
          JZ SCA2
          INC BX
          LOOP SCA1
          JMP SCA9
          SCA2: MOV CX, 5
          XCHG SI, BX
          MOV DI, OFFSET WEN16
          SCA3: MOV AL, [SI]
          MOV [DI], AL
          INC SI
          INC DI
          DEC CX
          JNZ SCA3
          SCA4: MOV CX, 3
          MOV SI, OFFSET WEN16+2
          MOV DI, OFFSET WEN9+10
          CLD
          SCA5: MOV AL, [SI]
          MOV [DI], AL
          INC SI
          INC DI
          DEC CX
          JNZ SCA5
          SCA6: MOV CX, 3
          MOV SI, OFFSET WEN16+2
          MOV DI, OFFSET WEN11+8
          SCA61: MOV AL, [SI]
          MOV [DI], AL
          INC SI
          INC DI
          DEC CX
          JNZ SCA61
          SCA7: MOV CX, 3
          MOV SI, OFFSET WEN16+2
          MOV DI, OFFSET WEN12+9
          SCA71: MOV AL, [SI]
          MOV [DI], AL
          INC SI
          INC DI
          DEC CX
          JNZ SCA71
          SCA8: MOV CX, 3
          MOV SI, OFFSET WEN16+2
          MOV DI, OFFSET WEN13+9
          SCA81: MOV AL, [SI]
          MOV [DI], AL
          INC SI
          INC DI
          DEC CX
          JNZ SCA81
          POP BX
          SCA9: RET
          SCAR ENDP
          KCHR PROC NEAR
          K: PUSH AX
          PUSH bx
          PUSH DX
          K1: MOV BX, OFFSET WEN20
          K2: MOV AL, [BX]
          PUSH BX
          AND AL, 7FH
          MOV BX, 0
          MOV AH, 14
          INT 10H
          POP BX
          INC BX
          LOOP K2
          MOV AL, 0AH
          MOV AH, 14
          MOV BX, 0
          INT 10H
          POP DX
          POP BX
          POP AX
          RET
          KCHR ENDP
          TS1CHR PROC NEAR
          TS1: PUSH DX
          TSO1: MOV DX, 3FDH
          IN AL, DX
          TEST AL, 20H
          JZ TSO1
          MOV DX, 3F8H
          MOV AL, [BX]
          OUT DX, AL
          MOV CX, 8
          YES1: NOP
          NOP
          LOOP YES1
          INC BX
          POP DX
          DEC DX
          JNE TS1
          RET
          TS1CHR ENDP
          NOP
          NOP
          RCVCHR PROC NEAR
          RCV: MOV DL, CL
          MOV BX, OFFSET WEN20
          RCV1: PUSH DX
          RCV2: MOV DX, 3FDH
          IN AL, DX
          TEST AL, 01H
          JZ RCV2
          MOV DX, 3F8H
          IN AL, DX
          MOV [BX], AL
          INC BX
          POP DX
          DEC DL
          JZ RPP
          SUB AL, 45H
          JZ RPP0
          LOOP RCV1
          JMP RPP
          RPP0: MOV AL, 45H
          MOV BX, OFFSET WEN20+80
          MOV [BX], AL
          RPP: RET
          RCVCHR ENDP
          NOP
          START ENDP
          CODE ENDS
          END START


          評論


          技術(shù)專區(qū)

          關(guān)閉