mov temp0,ah ;将个位数放入temp0 mov ah,0 mov bl,10 div bl
mov temp1,ah ;将十位数放入temp1 mov temp2,al pop ax push ax mov al,temp2 mov ah,0 add ax,0a3b0h
mov [hz_tab+6],ax pop ax push ax mov al,temp1 mov ah,0 add ax,0a3b0h
mov [hz_tab+8],ax pop ax push ax mov al,temp0 mov ah,0
;将百位数放入temp2
;出栈 ;将百位移入第二行的字符显示表 ;将十位放入字符显示表 - 33 -
add ax,0a3b0h
mov [hz_tab+10],ax ;将个位放入字符显示表 pop ax
ret ;返回主程序
segret endp clear proc mov al,0ch
mov dx,io8255a
out dx,al ;设臵清除命令 call cmd_setup ;启动LCD执行命令 ret
clear endp
lcd_disp proc
lea bx,hz_tab cmp ch,2 jz disp_sec
mov byte ptr hz_adr,88h ;第三行起始端口地址 add bx,16 ;指向第二行信息 jmp next
disp_sec: mov byte ptr hz_adr,90h next: mov cl,8
- 34 -
continue: push cx
mov al,hz_adr mov dx,io8255a out dx,al
call cmd_setup ;设定DDRAM地址命令 mov ax,[bx] push ax
mov al,ah ;先送汉字编码高位 mov dx,io8255a out dx,al
call data_setup ;输出汉字编码高位字节 call delay pop ax mov dx,io8255a
out dx,al
call data_setup ;输出汉字编码低位字节 call delay
inc bx
inc bx ;修改显示内码缓冲区指针 inc byte ptr hz_adr ;修改LCD显示端口地址 pop cx
- 35 -
dec cl jnz continue
ret
lcd_disp endp
cmd_setup proc mov dx,io8255c nop
mov al,00h 端=0) out dx,al call delay nop
mov al,04h out dx,al nop call delay
mov al,00h out dx,al call delay
ret
cmd_setup endp
;指向8255端口控制端口 臵0,PC0臵(0LCD I端=0 臵1(LCD E端=1) ;PC2臵0(LCD E端=0) - 36 -
W
;PC1 ;PC2