12月26日 接口上机试题 (中午)
题目:用计数器/定时器8253,通道1,方式0,计数器初值为0fh,手动单脉冲控制从8255a口输出到数码器,以递增的顺序显示0~f。要求:写出控制方式字,初值和连线图。
程序如下:
1:8255方式字=10000000=80h;
8253方式字=01010000=50h;
2:初值=0fh;
3:连线图略;
4:程序:
data segment
led db 71h,79h,3fh,39h,7fh,77h,67h,7fh
db 07h,7ch,6dh,6eh,4fh,5bh,06h,3fh
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov dx,28bh
mov al,80h
out dx,al
mov dx,283h
mov al,50h
out dx,al
mov dx,281h
mov al,0fh
out dx,al
inout:in al,dx
and al,0fh
mov bx,offset led
xlat
mov dx,288h
out dx,al
mov ah,1
int 16h
je inout
mov ah,4ch
int 21h
code ends
end start
(04年)9月6日接口上机试题(上午)
题目:8255A c口低四位输入,a口输出到数码段,当pc0=0 时,a口输出是加一循环(0~f),pc0=1时,a口输出是减一循环(f~0),输出时延一秒钟,有键按下就退出...
程序如下:
data segment
led db 71h,79h,3fh,39h,7fh,77h,67h,7fh
db 07h,7ch,6dh,6eh,4fh,5bh,06h,3fh
count db 0(定义循环初始值为零)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov dx,28bh
mov al,81h
out dx,al(8255初始化)
input:
mov dx,28ah
in al,dx
and al,0fh
and al,01h(判断pc0)
jz a1
mov al,count
and al,0fh(要屏蔽高四位,以免超过15后出乱码)
lea bx,led
xlat
mov dx,288h
out dx,al
call delay(延迟子程序老师会给出)
dec count
mov ah,1
int 16h
jz input(判断是否有键按下,无则继续判断pc0)
jmp a2(有则返回dos)
a1: mov al,count
and al,0fh
lea bx,led
xlat
mov dx,288h
out dx,al
call delay
inc count
mov ah,1
int 16h
jz input
a2: mov ah,4ch
int 21h
delay proc near
.
.
.
delay endp
code ends
end start
9月7日接口上机试题(上午)
题目:8255方式0,从C口输入一个数最大值为0FFH,再检测C0输入的数据,如为1,则+1,从A口输出,如为0,则-1从A口输出,延时一秒,有键按下则退出
程序如下:
code segment
assume cs:code
start:mov al,89h
mov dx,28bh
out dx ,al
mov dx,28ah
in al,dx
mov bl,al
mov cl,al
l:mov dx,28ah
in al,dx
test al,1
jz a
inc bl
mov al,bl
jmp b
a:dec cl
mov al,cl
b:mov dx,288h
out dx.al
mov ah,16h
int 21h
jz l
mov ah,4ch
int 21h
delay proc near
.
.
.
dalay endp
code ends
end start