SN8P2714X_2715
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 19
V1.4
3.1.4 GENERAL PURPOSE PROGRAM MEMORY AREA
The ROM locations 0001H~0007H and 0009H~07FBH are used as general-purpose memory. The area is stored
instruction’s op-code and look-up table data. The SN8P2710 includes jump table function by using program counter
(PC) and look-up table function by using ROM code registers (R, Y, Z).
The boundary of program memory is separated by the high-byte program counter (PCH) every 100H. In jump table
function and look-up table function, the program counter can’t leap over the boundary by program counter
automatically. Users need to modify the PCH value to “PCH+1” as the PCL overflow (from 0FFH to 000H).
3.1.5 LOOKUP TABLE DESCRIPTION
In the ROM’s data lookup function, Y register to the highest 8-bit and Z register to the lowest 8-bit data of ROM
address. After MOVC instruction is executed, the low-byte data of ROM then will be stored in ACC and high-byte data
stored in R register.
Â
Example: To look up the ROM data located “TABLE1”.
B0MOV
Y, #TABLE1$M
; To set lookup table1’s middle address
B0MOV
Z, #TABLE1$L
; To set lookup table1’s low address.
MOVC
; To lookup data, R = 00H, ACC = 35H
;
; Increment the index address for next address
INCMS Z
;
Z+1
JMP
@F
; Not overflow
INCMS
Y
; Z overflow (FFH
Æ
00),
Æ
Y=Y+1
NOP
; Not overflow
;
@@:
MOVC
; To lookup data, R = 51H, ACC = 05H.
.
.
;
TABLE1:
DW
0035H
; To define a word (16 bits) data.
DW
5105H
; “
DW
2012H
; “
¾
CAUSION: The Y register can’t increase automatically if Z register cross boundary from 0xFF to 0x00.
Therefore, user must take care such situation to avoid loop-up table errors. If Z register overflow, Y
register must be added one. The following INC_YZ macro shows a simple method to process Y and Z
registers automatically.
¾
Note: Because the program counter (PC) is only 12-bit, the X register is useless in the application. Users
can omit “B0MOV X, #TABLE1$H”. SONiX ICE support more larger program memory addressing
capability. So make sure X register is “0” to avoid unpredicted error in loop-up table operation.
Â
Example: INC_YZ Macro
INC_YZ
MACRO
INCMS
Z
; Z+1
JMP
@F
; Not overflow
INCMS
Y
; Y+1
NOP
; Not overflow
@@:
ENDM