《微机原理8251串口实验自发自收代码.doc》由会员分享,可在线阅读,更多相关《微机原理8251串口实验自发自收代码.doc(6页珍藏版)》请在三一文库上搜索。
1、8251 串口实验 自发自收CODE SEGMENTASSUME CS:CODE,DS:CODE,ES:CODEORG 35C0H ;TX=RXH11:JMP STARTZ8251 EQU 0FFE1HD8251 EQU 0FFE0HCOM_MOD EQU 04EHCOM_COM EQU 25HZXKEQU 0FFDCHZWKEQU 0FFDDHLED DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90HDB 88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,0DEH,0F3H BUF DB ?,?,?,?,?,?START: MO
2、V BX,0400HMOV AL,BXCMP AL,00HJNZ SR0SR8251: MOV DX,Z8251MOV AL,COM_MODOUT DX,ALMOV AL,01HMOV BX,0400HMOV BX,ALSR0:CALL WPMOV SI,4000HMOV DI,5000HMOV CX,0010HSR1:MOV AH,SICALL SENDCALL RXMOV DI,AHINC SIINC DILOOP SR1SR2:CALL DISJMP SR2RX:MOV DX,Z8251RX1:IN AL,DXTEST AL,02HJZ RX1IN AL,DXMOV AH,ALRETWP
3、: MOV BUF,11HMOV BUF+1,10HMOV BUF+2,10HMOV BUF+3,10HMOV BUF+4,10HMOV BUF+5,10HRETSEND: MOV DX,Z8251W1: IN AL,DXTEST AL,01HJZ W1MOV DX,D8251MOV AL,AHOUT DX,ALRETMOV BX,OFFSET BUFDIS1: MOV AL,BXPUSH BXMOV BX,OFFSET LEDXLATPOP BXMOV DX,ZXKOUT DX,ALMOV AL,CLMOV DX,ZWKOUT DX,ALPUSH CXMOV CX,0100HDELAY: LOOP $POP CXCMP CL,01HJZ EXITINC BXSHR CL,1JMP DIS1OUT DX,ALRETCODE ENDSEND H11Welcome ToDownload !欢迎您的下载,资料仅供参考!