SN8P1829
8-Bit MCU build-in 12-bit ADC + PGIA + Charge-pump Reg 128 dots LCD driver
SONiX TECHNOLOGY CO., LTD
Page 22
Version 1.0
RAM BANK SELECTION
The RBANK is an 1-bit register located at 87H in RAM bank 0. The user can access RAM data by using this register
pointing to working RAM bank for ACC to read/write RAM data.
RBANK initial value = XXXX 0000
087H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
RBANK
- - - -
RBNKS3
RBNKS2
RBNKS1
RBNKS0
- - - -
R/W
R/W
R/W
R/W
RBNK
N
: RAM bank selecting control bit. 0 = bank 0, 1 = bank 1.
Example: RAM bank selecting.
; BANK 0
CLR
RBANK
.
; BANK 1
MOV
A,
#1
B0MOV RBANK, A
.
Note: “B0MOV” instruction can access the RAM of bank 0 in any RBANK situation.
Example: Access bank 0 data when RBANK points to bank 1.
; BANK 1
B0BSET RBNKS0 ; Get into RAM bank 1
B0MOV A, BUF0 ; Read BUF0 data. BUF0 is in RAM bank0.
MOV
BUF1, A ; Write BUF0 data to BUF1. BUF1 is in RAM bank1.
.
.
.
MOV
A, BUF1 ; Read BUF1 data and store in ACC.
B0MOV BUF0, A ; Write ACC data to BUF0.
When RBANK points to bank 1, using “B0MOV” instruction is an easy way to access RAM bank 0 data. User can make
a habit to read/write system register (0087H~00FFH). Then user can access system registers without switching RAM
bank.
Example: To Access the system registers when RBANK points to bank 1.
; BANK 1
B0BSET RBNKS0 ; Get into RAM bank 1
.
.
MOV
A, #0FFH ; Set all pins of P1 to be logic high.
B0MOV
P1,
A
.
B0MOV A, P0
; Read P0 data and store into BUF1 of RAM bank 1.
MOV
BUF1,
A