当前位置:首页 >> 电子/电路 >>

LCD1602显示全部字库字符


LCD1602 显示全部字库字符、看门狗定时器测试

LCD1602 液晶内含有 192 个字符字库,这个程序是分 6 屏进行显示,整个显示过程长 约 7 秒,看门狗定时器设置时间为 8.38 秒,刚好显示完全部字符,修改看门狗就可以看到 在显示中途重启,比较直观 LCD_E BIT P3.4 LCD_RS BIT P3.5 LCD_RW BIT P3.6 PORT EQU P0 WDT_COUNT EQU 0E1H START: ;LCD 片选 ;指令、数据位 ;读、写位 ;端口定义 ;看门狗

LCALL LCD_INIT LCALL WDT_INIT MOV A,#01H ;清屏 LCALL WR_CMD DISP_LOOP: MOV R0,#06H ;循环计数器 MOV R1,#80H ;LCD 地址计数器 MOV R2,#00H ;字符表指针计数器 MOV DPTR,#TAB WR_DAT_LOOP: MOV A,R1 ;地址命令 LCALL WR_CMD INC R1 ;地址加一 MOV A,R2 ;表指针 MOVC A,@A+DPTR LCALL WR_DAT LCALL DELAY100MS INC R2 ;表指针加一 CJNE R1,#90H,BIJIAO ;字符是否到 16 MOV R1,#0C0H ;到 16,换地址 BIJIAO: CJNE R1,#0D0H,WR_DAT_LOOP ;字符数是否到 32 MOV R1,#80H ;地址回归 LCALL DELAY1S MOV A,#1B ;清屏 LCALL WR_CMD DJNZ R0,WR_DAT_LOOP MOV WDT_COUNT,#00110111B LJMP DISP_LOOP LCD_INIT: MOV A,#111000B LCALL WR_CMD MOV A,#10B ;8 位总线 ;数据指针清零

LCALL WR_CMD MOV A,#01H LCALL WR_CMD MOV A,#1111B LCALL WR_CMD MOV A,#10000000B LCALL WR_CMD RET WDT_INIT:

;清屏 ;显示开,光标开,闪烁开 ;设置显示地址 00H

MOV WDT_COUNT,#00110111B ;看门狗定时器设置时间 1.1 秒 RET SETB PORT.7 CLR LCD_RS SETB LCD_RW SETB LCD_E MOV C,PORT.7 JC WAIT1 CLR LCD_E RET

CHK_BUSY:

WAIT1:

WR_CMD:

LCALL CHK_BUSY CLR LCD_RS CLR LCD_RW SETB LCD_E MOV PORT,A CLR LCD_E RET LCALL CHK_BUSY SETB LCD_RS CLR LCD_RW SETB LCD_E MOV PORT,A CLR LCD_E RET

WR_DAT:

DELAY100MS: MOV R7,#10 DL5: MOV R6,#250 DL4: NOP NOP DJNZ R6,DL4 DJNZ R7,DL5

RET DELAY1S: DL1: DL2: DL3: MOV R7,#10 MOV R6,#200 MOV R5,#248 DJNZ R5,DL3 DJNZ R6,DL2 DJNZ R7,DL1 RET

TAB: DB 20H,21H,22H,23H,24H,25H,26H,27H,28H,29H,2AH,2BH,2CH,2DH,2EH,2FH DB 30H,31H,32H,33H,34H,35H,36H,37H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH DB 40H,41H,42H,43H,44H,45H,46H,47H,48H,49H,4AH,4BH,4CH,4DH,4EH,4FH DB 50H,51H,52H,53H,54H,55H,56H,57H,58H,59H,5AH,5BH,5CH,5DH,5EH,5FH DB 60H,61H,62H,63H,64H,65H,66H,67H,68H,69H,6AH,6BH,6CH,6DH,6EH,6FH DB 70H,71H,72H,73H,74H,75H,76H,77H,78H,79H,7AH,7BH,7CH,7DH,7EH,7FH DB 0A0H,0A1H,0A2H,0A3H,0A4H,0A5H,0A6H,0A7H,0A8H,0A9H,0AAH,0ABH,0ACH,0ADH,0 AEH,0AFH DB 0B0H,0B1H,0B2H,0B3H,0B4H,0B5H,0B6H,0B7H,0B8H,0B9H,0BAH,0BBH,0BCH,0BDH,0BE H,0BFH DB 0C0H,0C1H,0C2H,0C3H,0C4H,0C5H,0C6H,0C7H,0C8H,0C9H,0CAH,0CBH,0CCH,0CDH,0CE H,0CFH DB 0D0H,0D1H,0D2H,0D3H,0D4H,0D5H,0D6H,0D7H,0D8H,0D9H,0DAH,0DBH,0DCH,0DDH,0 DEH,0DFH DB 0E0H,0E1H,0E2H,0E3H,0E4H,0E5H,0E6H,0E7H,0E8H,0E9H,0EAH,0EBH,0ECH,0EDH,0EEH ,0EFH DB 0F0H,0F1H,0F2H,0F3H,0F4H,0F5H,0F6H,0F7H,0F8H,0F9H,0FAH,0FBH,0FCH,0FDH,0FEH,0 FFH END


相关文章:
超强的51+LCD1602控制(四位,八位控制),1602函数全集+写...
1602 函数全集+写入字库 LCD1602字库在文档后面...// 定位输出字符串 void LCD_printn(unsigned char...(0x38); //两行显示 8-bits #define LCD_...
更多相关标签: