HT48R50A的 LCD显示示例程序
; ********************************************
; Function : LCD显示示例程序 *
; MICroProcessor : HT48R50A-1/28SKDIP-A *
; Author: www.picavr.com *
; Crystal : 4MHz *
; ********************************************
#INCLUDE HT48R50A-1.INC
LCD_DATA EQU PA
LCD_DATA_CTRL EQU PAC
LCD_CTRL EQU PC
LCD_CTRL_CTRL EQU PCC
E EQU 2
RW EQU 1
RS EQU 0
;------------------------------------------------------
DATA .SECTION AT 60H ’DATA’
DELAY_COUNTER_1 DB ? ;[60H]
DELAY_COUNTER_2 DB ? ;[61H]
DELAY_COUNTER_3 DB ? ;[62H]
DISPLAY_DATA DB ? ;[63H]
DISPLAY_COUNTER DB ? ;[64H]
;------------------------------------------------------
CODE .SECTION AT 00H ’CODE’
ORG 00H
JMP START
START:
CLR LCD_DATA
CLR LCD_DATA_CTRL
CLR LCD_CTRL
CLR LCD_CTRL_CTRL
CALL DELAY
CLR TBLP
MOV A,30H ;\
MOV LCD_DATA,A ; > STEP 0
CALL WRITE ;/ LCD RESET
CALL DELAY
MOV A,30H ;\
MOV LCD_DATA,A ; > STEP 0
CALL WRITE ;/ LCD RESET
CALL DELAY
MOV A,38H ;\
MOV LCD_DATA,A ; > STEP 1
CALL WRITE ;/ Function set
MOV A,06H ;\
MOV LCD_DATA,A ; > STEP 2
CALL WRITE ;/ Entry mode set
MOV A,01H ;\
MOV LCD_DATA,A ; > STEP 3
CALL WRITE ;/ Display clear
CALL DELAY
MOV A,0EH ;\
MOV LCD_DATA,A ; > STEP 4
CALL WRITE ;/ Display turn on/off
MOV A,83H ;\
MOV LCD_DATA,A ; > STEP 5
CALL WRITE ;/ DD RAM address set(First line)
SET LCD_CTRL.RS ; STEP 6
MOV A,0AH ; DD RAM data write
MOV DISPLAY_COUNTER,A
DISPLAY1:
TABRDL DISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALL WRITE
INC TBLP
SDZ DISPLAY_COUNTER
JMP DISPLAY1
CLR LCD_CTRL.RS ;\
MOV A,0C3H ; > STEP 7
MOV LCD_DATA,A ; | DD RAM address set(Second line)
CALL WRITE ;-
SET LCD_CTRL.RS ; SETP 8
MOV A,0AH ; DD RAM data write
MOV DISPLAY_COUNTER,A
DISPLAY2:
TABRDL DISPLAY_DATA
MOV A,DISPLAY_DATA
MOV LCD_DATA,A
CALL WRITE
INC TBLP
SDZ DISPLAY_COUNTER
JMP DISPLAY2
HALT
RET
;------------------------------------------------------
WRITE PROC
SET LCD_CTRL.E
CLR LCD_CTRL.E
MOV A,0FFH
MOV DELAY_COUNTER_1,A
WAIT:
SDZ DELAY_COUNTER_1
JMP WAIT
RET
WRITE ENDP
;------------------------------------------------------
DELAY PROC
MOV A,003H
MOV DELAY_COUNTER_1,A
MOV DELAY_COUNTER_2,A
MOV DELAY_COUNTER_3,A
WAITING:
SDZ DELAY_COUNTER_3
JMP WAITING
SDZ DELAY_COUNTER_2
JMP WAITING
SDZ DELAY_COUNTER_1
JMP WAITING
RET
DELAY ENDP
;------------------------------------------------------
ORG 0F00H
;[LCD.......]
;[Test OK !!]
DC 4CH,43H,44H,2EH,2EH,2EH,2EH,2EH,2EH,2EH
DC 54H,65H,73H,74H,20H,4FH,4BH,20H,21H,21H
;------------------------------------------------------
END
上一篇:HT48R50A的4X4按键显示程序
下一篇:HT48R50A的 5X7 LED点阵显示示例程序
推荐阅读最新更新时间:2024-03-16 15:53
设计资源 培训 开发板 精华推荐
- 非常见问题解答第223期:如何在没有软启动方程的情况下测量和确定软启动时序?
- 兆易创新GD25/55全系列车规级SPI NOR Flash荣获ISO 26262 ASIL D功能安全认证证书
- 新型IsoVu™ 隔离电流探头:为电流测量带来全新维度
- 英飞凌推出简化电机控制开发的ModusToolbox™电机套件
- 意法半导体IO-Link执行器电路板为工业监控和设备厂商带来一站式参考设计
- Melexis采用无磁芯技术缩小电流感测装置尺寸
- 千丘智能侍淳博:用数字疗法,点亮“孤独症”儿童的光
- 数药智能冯尚:ADHD数字疗法正为儿童“多动症”提供更有效便捷服务
- Vicor高性能电源模块助力低空航空电子设备和 EVTOL的发展
- 创实技术electronica 2024首秀:加速国内分销商海外拓展之路