org
04h
;external interrupt subroutine
reti
;for safeguard
org
08h
;timer/event 0 interrupt subroutine
reti
;for safeguard
org
0ch
;timer/event 1 interrupt subroutine
reti
;for safeguard
start:
;
clr
intc
;initialize registers
clr
tmrc
;to guarantee performance
clr
tmr
;(interrupts)
set
pac
;(ports)
set
pbc
;(input mode)
set
pcc
;
main:
clr
LCM_DATA_CTRL
;set LCM data port to output port
clr
LCM_CTRL_CTRL
;set LCM control port to output port
clr
LCM_DATA
clr
LCM_CTRL
DISPLAY_INIT:
ifdef four_bit
;
mov
a,20h
;4-bit mode
else
mov
a,30h
;8-bit mode
endif
mov
LCM_DATA,a
set
LCM_CTRL.E
;write instruction code to
clr
LCM_CTRL.E
;initalize LCM
LCM_DELAY:
;delay for LCM setup timing
mov
a,0ffh
;need about 4.5ms
mov
counter1,a
mov
counter0,a
lp0:
sdz
counter1
jmp
lp0
sdz
counter0
jmp
lp0
CMD_SEQ:
ifdef four_bit
;
mov
a,28h
;4-bit mode and 2 lines (2 pass/byte)
else
;28h for 2 lines and 20h for 1 line
mov
a,38h
;8-bit mode and 2 lines
endif
;38h for 2 lines and 30h for 1 line
mov
LCM_DATA,a
;
set
LCM_CTRL.E
clr
LCM_CTRL.E
ifdef four_bit
mov
a,80h
;4-bit high nibble (2nd pass)
endif
mov
LCM_DATA,a
;write instruction code
HT-IDE User’s Guide
198
Содержание 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 ...