ST2601B
Step1: use the macro “SWITCH_SYSCLK_32K_TO_RC ” to change Sysclk to RC
(7) sample code
1. When B/W, 4G, 16G mode change to fast B/W mode or fast B/W mode change to B/W, 4G, 16G mode, must turn off LCD.
for example: B/W, 4G, 16G mode change to fast B/W mode.
;====Step1 LCD OFF ===
LDA LCTR
ORA #10000000B
STA
LCTR
;====Step2 set GL[3:2]=11, fast B/W mode ===
LDA LCTR
ORA #00001100B
STA
LCTR
;=== Step3 set Frame rate about 65 Hz ===
LDA #6
STA
;when Sysclk is changed to 32k, LFRA can’t be modified. Thus LFRA
;is determined by equation2. Let the frame rate in sysclk=32k mode is
;about 65hz
LFRA
LDA #00001000B
STA LCKR
;since LFRA has been determined, LCKR is determined by frame rate equation.
;Let the frame rate in Sysclk=RC mode is about 65hz
;===Step4 LCD ON ===
LDA LCTR
AND #~10000000B
STA LCTR
[After setting up fast B/W mode, then switch SYSCK from RC to 32k]
2. Sysck from RC change to 32k…
Please use the macro “SWITCH_SYSCLK_RC_TO_32K”.
This macro will use 4 bytes RAM. They are show below.
;===== used ram ====
LCD_FLAG
IENAL_BAK
IENAH_BAK
LPCK_BAK
DS
1
DS
DS
1
1
DS 1
And this macro will also use LCD interrupt. Please copy below program in LCD interrupt service routine.
;==== LCD interrupt service routine ===
LCDFR_ISR:
PHA
LDA #FFH
STA
RMB7
PLA
RTI
LCD_FLAG
IENAL
;DISABPLE LCD INTERRUPT
The declaration of this macro is show below (please don’t modify this macro)
SWITCH_SYSCLK_RC_TO_32K
.MACRO
;=== backup LPCK ===
LDA LPCK
STA
LPCK_BAK
LDA #2
STA
LPCK
;=== BACKUP IENAL/H AND ONLY ENABLE LCD INT ===
SEI
LDA IENAL
STA
IENAL_BAK
LDA IENAH
STA
IENAH_BAK
LDA #10000000B
;ONLY ENABLE LCD INT
STA
STZ
IENAL
IENAH
LDA #01111111B
27/35