gzyueqian
13352868059
首页 > 新闻中心 > > 正文

带LCD 驱动MCU 在显示方面的软件设计

更新时间: 2008-03-08 10:28:00来源: 粤嵌教育浏览量:847

  本文以简单例程介绍了带LCD 驱动MCU 在显示方面的软件设计,适用于所有带LCD驱动功能的HOLTEK MCU。该例程以A/D with LCD 型芯片HT46R62 为母体,驱动三位七段码的LCD 屏(如下图)做显示,以每秒递加方式循环显示000~999。

应用说明:

1. LCD 屏及与MCU 连接引脚:
               


2. LCD 显示段码与MCU 显存对应关系:
              


3. 本范例同时提供配合HOLTEK LCD 仿真器的液晶面板文件LcdDemo.lcd 及LCD
  各段码图案,以方便调试及应用。
程序清单:
;*********************************************
;FILE NAME: LCD DEMO
;MCU: HT46R62
;MASK OPTION: WDT: DISABLE
; LCD DUTY: 1/3
; LCD BIAS: 1/2
; LCD BIAS TYPE: C
; SYSVOLT: 5.0V
; SYSFRAG: 4000KHZ
;AUTHOR: RADOME
;HISTORY: 2006.01.20
;*********************************************
include Ht46r62.inc
include Micro.inc
;*********************************************
lcd_data .section data
;*********************************************
acc_bk db ?
status_bk db ?
msecond db ?
number1 db ?
number2 db ?
number3 db ?
display_temp db ?
f_display dbit
;*********************************************
lcd_code .section code
;*********************************************
org 0000h
jmp init
org 000ch
timer_int: ;8ms
push
inc msecond
mov a,msecond
sub a,125 ;8ms*125=1s
snz c
jmp timer_end
clr msecond
set f_display
timer_end:
pop
reti
;*********************************************
;Initializers
;*********************************************
init:
clr wdt
clr intc0
clr intc1
clr rtcc
clr msecond
clr number1
clr number2
clr number3
mov a,00001001b
mov intc0,a
mov a,6 ;8ms
mov tmr,a
mov a,10010111b
mov tmrc,a
;*********************************************
;Display
;*********************************************
display:
snz f_display
jmp display
clr f_display
inc number3
mov a,number3
sub a,10
snz c
jmp display_next
clr number3
inc number2
mov a,number2
sub a,10
snz c
jmp display_next
clr number2
inc number1
mov a,number1
sub a,10
snz c
jmp display_next
clr number1
display_next:
set bp.0
mov a,40h
mov mp1,a
display_number1:
mov a,number1
add a,number_table
mov tblp,a
tabrdl display_temp
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
display_number2:
mov a,number2
add a,number_table
mov tblp,a
tabrdl display_temp
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
display_number3:
mov a,number3
add a,number_table
mov tblp,a
tabrdl display_temp
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
inc mp1
rl display_temp
rl display_temp
rl display_temp
mov a,display_temp
mov iar1,a
clr bp.0
jmp display
;*********************************************
;Table
;*********************************************
org 0700h
number_table:
; bdeacfg0
dw 10111110b ;0
dw 00001100b ;1
dw 01111010b ;2
dw 01011110b ;3
dw 11001100b ;4
dw 11010110b ;5
dw 11110110b ;6
dw 00011100b ;7
dw 11111110b ;8
dw 11011110b ;9
;*********************************************
end

免费预约试听课