《微机原理8251串口实验自发自收代码.doc》由会员分享,可在线阅读,更多相关《微机原理8251串口实验自发自收代码.doc(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-date微机原理8251串口实验自发自收代码微机原理8251串口实验自发自收代码8251串口实验 自发自收 CODE SEGMENT ASSUME CS:CODE,DS:CODE,ES:CODE ORG 35C0H ;TX=RX H11: JMP START Z8251 EQU 0FFE1H D8251 EQU 0FFE0H COM_MOD EQU 04EH COM_COM
2、EQU 25H ZXK EQU 0FFDCH ZWK EQU 0FFDDH LED DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H DB 88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,0DEH,0F3H BUF DB ?,?,?,?,?,? START: MOV BX,0400H MOV AL,BX CMP AL,00H JNZ SR0 SR8251: MOV DX,Z8251 MOV AL,COM_MOD OUT DX,AL MOV AL,COM_COM OUT DX,AL MOV AL,01H MOV BX,0400H
3、 MOV BX,AL SR0: CALL WP MOV SI,4000H MOV DI,5000H MOV CX,0010H SR1: MOV AH,SI CALL SEND CALL RX MOV DI,AH INC SI INC DI LOOP SR1 SR2: CALL DIS JMP SR2 RX: MOV DX,Z8251 RX1: IN AL,DX TEST AL,02H JZ RX1 MOV DX,D8251 IN AL,DX MOV AH,AL RET ;- WP: MOV BUF,11H MOV BUF+1,10H MOV BUF+2,10H MOV BUF+3,10H MO
4、V BUF+4,10H MOV BUF+5,10H RET ;- SEND: MOV DX,Z8251 W1: IN AL,DX TEST AL,01H JZ W1 MOV DX,D8251 MOV AL,AH OUT DX,AL RET ;- DIS: MOV CL,20H MOV BX,OFFSET BUF DIS1: MOV AL,BX PUSH BX MOV BX,OFFSET LED XLAT POP BX MOV DX,ZXK OUT DX,AL MOV AL,CL MOV DX,ZWK OUT DX,AL PUSH CX MOV CX,0100H DELAY: LOOP $ POP CX CMP CL,01H JZ EXIT INC BX SHR CL,1 JMP DIS1 EXIT: MOV AL,00H MOV DX,ZWK OUT DX,AL RET ;- CODE ENDS END H11 -