set
LCM_CTRL.E
;high
clr
LCM_CTRL.E
;low (trigger)
ifdef four_bit
swapa
dtmp
;4-bit low nibble (two pass)
and
a,0f0h
mov
LCM_DATA,a
;latch command
set
LCM_CTRL.E
;high
clr
LCM_CTRL.E
;low (trigger)
endif
ret
;== busy_chk ==
busy_chk:
;=test busy flag=
clr
LCM_CTRL.E
;ready to pulse (low)
set
LCM_DATA_CTRL
;set LCM data port to input port
clr
LCM_CTRL.RS
;RS=0
set
LCM_CTRL.RW
;RW=1
set
LCM_CTRL.E
;pulse (high)
mov
a,LCM_DATA
;load busy flag
clr
LCM_CTRL.E
;pulse (low)
ifdef four_bit
and
a,0f0h
;4-bit mode high nibble (1st pass)
mov
dtmp,a
;
set
LCM_CTRL.E
;pulse (high)
swapa
LCM_DATA ;a.3~a.0.7~m.4+,
a.7~a.4.3~m.0
clr
LCM_CTRL.E
;pulse (low)
and
a,0fh
;4-bit mode low nibble (2nd pass)
or
a,dtmp
;combine 2 pass
endif
sz
acc.7
;is busy?
jmp
busy_chk
;yes. check again
clr
LCM_CTRL.RW
;no. go ahead
clr
LCM_DATA_CTRL
;set LCM_DATA to output port
ret
;== write_char ==
write_char:
;=write data to LCM=
ifdef four_bit
;4-bit mode (2 pass)
mov
dtmp,a
and
a,0f0h
;filter high nibble
endif
mov
LCM_DATA,a
;latch data
clr
LCM_CTRL.RW
;RW=0
set
LCM_CTRL.RS
;RS=1 (write operation)
set
LCM_CTRL.E
;high
clr
LCM_CTRL.E
;low (trigger)
ifdef four_bit
swapa
dtmp
;4-bit mode (2nd pass)
and
a,0f0h
;filter low nibble
mov
LCM_DATA,a
;latch data
set
LCM_CTRL.E
;high
Chapter 15 Input/Output Applications
201
Содержание HT-IDE
Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Страница 12: ...HT IDE User s Guide 2 ...
Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Страница 24: ...HT IDE User s Guide 14 ...
Страница 70: ...HT IDE User s Guide 60 ...
Страница 76: ...HT IDE User s Guide 66 ...
Страница 92: ...HT IDE User s Guide 82 ...
Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Страница 94: ...HT IDE User s Guide 84 ...
Страница 148: ...HT IDE User s Guide 138 ...
Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Страница 154: ...HT IDE User s Guide 144 ...
Страница 192: ...HT IDE User s Guide 182 ...
Страница 194: ...HT IDE User s Guide 184 ...
Страница 218: ...HT IDE User s Guide 208 ...
Страница 235: ...P a r t V Appendix Part V Appendix 225 ...
Страница 236: ...HT IDE User s Guide 226 ...
Страница 250: ...HT IDE User s Guide 240 ...