微机原理实验8255并行口实验PA输入、PB输出

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

8255A并行口实验PA输入、PB输出利用LED等显示

程序

LCD EQU 07FE0H

LCDWI EQU LCD+0 ;写命令

LCDWD EQU LCD+1 ;写数据

LCDRS EQU LCD+2 ;读状态

LCDRD EQU LCD+3 ;读数据

PA EQU 0FFD8H

PB EQU 0FFD9H

PC EQU 0FFDAH

PCTL EQU 0FFDBH

code segment

assume cs:code

lin db 0

col db 0

num db 0

dis_num db 0

temp0 db 0

temp1 db 0

count db 0

org 1000h

start: MOV DX,PCTL

MOV AL,90H

OUT DX,AL

call init_lcd

mov al,3

call delay2

mov count,0

mov bx,offset tab0

mov lin,0

mov col,0

mov num,16

call dis_english

GOON: MOV DX,PA

IN AL,DX

TEST AL,01H

JE GOON1

TEST AL,02H

JE GOON2

TEST AL,04H

JZ GOON3

TEST AL,08H

JE GOON4

TEST AL,10H

JE GOON5

TEST AL,20H

JE GOON6

TEST AL,40H

JE GOON7

TEST AL,80H

JZ GOON8

JMP GOON9

GOON1: JMP KEY1

GOON2: JMP KEY2

GOON3: JMP KEY3

GOON4: JMP KEY4

GOON5: JMP KEY5

GOON6: JMP KEY6

GOON7: JMP KEY7

GOON8: JMP KEY8

GOON9: mov bx,offset tab9

mov lin,1

mov col,0

mov num,16

call dis_english

MOV DX,PB

MOV AL,0FFH

OUT DX,AL

JMP GOON

KEY1: MOV DX,PB

MOV AL,0FEH

OUT DX,AL

mov bx,offset tab1

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY2: MOV DX,PB

MOV AL,0FDH

OUT DX,AL

mov bx,offset tab2

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY3: MOV DX,PB

MOV AL,0FBH

OUT DX,AL

mov bx,offset tab3

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY4: MOV DX,PB

MOV AL,0F7H

OUT DX,AL

mov bx,offset tab4

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY5: MOV DX,PB

MOV AL,0EFH

OUT DX,AL

mov bx,offset tab5

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY6: MOV DX,PB

MOV AL,0DFH

OUT DX,AL

mov bx,offset tab6

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY7: MOV DX,PB

MOV AL,0BFH

OUT DX,AL

mov bx,offset tab7

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

KEY8: MOV DX,PB

MOV AL,07FH

OUT DX,AL

mov bx,offset tab8

mov lin,1

mov col,0

mov num,16

call dis_english

JMP GOON

dis_number proc

push ax

mov al,lin ;以下18条为根据行、列值定位显示英文起始坐标

cmp al,0

jnz nu0

mov al,80h

jmp nu1

nu0: cmp al,1

jnz nuret

mov al,0C0h

nu1: add al,col

call send_com

mov ah,0 ;以下10条为把3位十进制数的个位、十位、百位分离

mov al,dis_num

mov bl,10

div bl

mov temp0,ah

mov ah,0

mov bl,10

div bl

mov temp1,ah

add al,30h ;转为ASC码

call send_data ;百位送LCD显示

mov al,temp1

add al,30h ;转为ASC码

相关文档
最新文档