본문 바로가기

My Project/MDE Kit

MDE 80196 KIT, LCD 제어

여기 이넘은 간단하게 LCD를 제어할수가 있다.
일단 소스.
-------------------------------------------------
R0 EQU 0000H
SP EQU 18H
BREG1 EQU 20H
BREG2 EQU 21H
BREG3 EQU 22H

WBUF EQU 24H
WREG EQU 26H

LCDC EQU 0F000H
LCDD EQU LCDC+2
LCDS EQU LCDC+4

CSEG AT 4000H
LD SP,#00E0H

START:
SCALL ALLCLR
LD WBUF,#DATA1
SCALL STR_0
SCALL LN21
LD WBUF,#DATA2
SCALL STR_0
SCALL LN31
LD WBUF,#DATA3
SCALL STR_0
SCALL LN41
LD WBUF,#DATA4
SCALL STR_0

LOOP:
SCALL SH_L
SCALL TIMER
SJMP LOOP

DATA1: DCB ' 80196 KIT~~',00H
DATA2: DCB ' It is funny.',00H
DATA3: DCB ' It is MDE kit',00H
DATA4: DCB ' Good bye~ ' ,00H

STR_0:
LDB BREG1,[WBUF]+
CMPB BREG1,#0
JE STR_01
SCALL CHAROUT
SJMP STR_0

STR_01:
RET

CHAROUT:
CALL BUSY
STB BREG1,LCDD[R0]
RET

ALLCLR:
LDB BREG2,#1
SJMP LNXX

LN11:
LDB BREG2,#2
SJMP LNXX

LN21:
LDB BREG2,#0C0H
SJMP LNXX

LN31:
LDB BREG2,#11010000B
SJMP LNXX

LN41:
LDB BREG2,#11010000B
SJMP LNXX

SH_L:
LDB BREG2,#00011000B
LNXX:
SCALL BUSY
STB BREG2,LCDC[R0]
RET

BUSY:
PUSH BREG1
BUSY1:
LDB BREG2,LCDS[R0]
JBS BREG2,7,BUSY1
POP BREG1
RET

TIMER:
LD WREG,#60000
TIMER1:
NOP
NOP
NOP
NOP
NOP
DJNZW WREG,TIMER1
RET

END
------------------------------------------