261
CHAPTER 12 LCD CONTROLLER/DRIVER
●
Coding example
LCRAM EQU 0064H ;Starting address of LCD display RAM
LCDR EQU 0079H ;Address of LCD control register (LCDR)
SEGR EQU 007AH ;Address of segment output select register (SEGR)
LCD SEG CSEG ;8-segment LCD data
LCDDATA DB 11011111B ;"0"
DB 11001000B ;"1"
DB 11110110B ;"2"
DB 11111100B ;"3"
DB 11101001B ;"4"
DB 01111101B ;"5"
DB 01111111B ;"6"
DB 11011001B ;"7"
DB 11111111B ;"8"
DB 11111101B ;"9"
DB 00000000B ;END
LCD SEG ENDS
;-----Main program----------------------------------------------------------------
CSEG ; [CODE SEGMENT]
:
MOVW EP,#LCRAM ; Set LCD RAM address.
MOVW IX,#LCDDATA ; Set LCD data table address.
MOV SEGR,01111111B ; Set the segment output function.
LCDSET
MOV A,@IX+00H
MOV @EP,A
INCW EP
INCW IX
BNZ LCDSET ; Continue until data end (00H) is detected.
MOV LCDR,#00101111B ; Set LCDR and turn LCD display on.
:
ENDS
;---------------------------------------------------------------------------------
END