ST7066U
$" Initial Program Code Example For 8051 MPU(4 Bit Interface):
;-------------------------------------------------------------------
INITIAL_START:
;-------------------------------------------------------------------
WRINS_CHK:
CALL CHK_BUSY
WRINS_NOCHK:
PUSH
CALL DELAY40mS
MOV A,#38H
;FUNCTION SET
A
CALL WRINS_ONCE ;8 bit,N=1,5*7dot
CALL DELAY37uS
ANL A,#F0H
CLR RS
;EX:Port 3.0
CLR RW
;EX:Port 3.1
MOV A,#28H
;FUNCTION SET
SETB
E
;EX:Port 3.2
CALL WRINS_NOCHK ;4 bit,N=1,5*7dot
CALL DELAY37uS
MOV P1,A
;EX:Port1=Data Bus
CLR
E
A
POP
MOV A,#28H
;FUNCTION SET
SWAP
A
CALL WRINS_NOCHK ;4 bit,N=1,5*7dot
CALL DELAY37uS
WRINS_ONCE:
ANL A,#F0H
CLR RS
MOV A,#0FH
;DISPLAY ON
CLR RW
CALL WRINS_CHK
CALL DELAY37uS
SETB
MOV P1,A
CLR
E
E
MOV A,#01H
CALL WRINS_CHK
CALL DELAY1.52mS
;CLEAR DISPLAY
;ENTRY MODE SET
MOV P1,#FFH
RET
;-------------------------------------------------------------------
;For Check Bus Flag
CHK_BUSY:
PUSH
;Check Busy Flag
MOV A,#06H
A
CALL WRINS_CHK
CALL DELAY37uS
MOV P1,#FFH
$1
;-------------------------------------------------------------------
CLR RS
MAIN_START:
SETB RW
XXXX
XXXX
XXXX
SETB
MOV A,P1
CLR
E
E
XXXX
MOV P1,#FFH
CLR RS
SETB RW
.
.
.
.
.
.
.
.
.
.
SETB
NOP
CLR
JB
POP
RET
E
E
A.7,$1
A
.
.
V2.0
2001/03/01
26/42