Semiconductor Group
2-8
1998-04-01
CPU Functions
C500 Family
Example 2 : Using Two Datapointers (Code for a C509)
Initialization Routine
MOV
DPSEL, #06H
;Initialize DPTR6 with source pointer
MOV
DPTR, #1FFFH
MOV
DPSEL, #07H
;Initialize DPTR7 with destination pointer
MOV
DPTR, #2FA0H
Table Look-up Routine under Real Time Conditions
;
Number of cycles
PUSH
DPSEL
;Save old source pointer
2
MOV
DPSEL, #06H
;Load source pointer
2
;INC
DPTR
Increment and check for end of table (execution time
;CJNE
É
not relevant for this consideration)
Ð
MOVC
A,@DPTR
;Fetch source data byte from ROM table
2
MOV
DPSEL, #07H
;Save source_pointer and
;load destination_pointer
2
MOVX
@DPTR, A
;Transfer byte to destination address
2
POP
DPSEL
;Save destination pointer and
;restore old datapointer
2
;
Total execution time (machine cycles) : 12
The above example shows that utilization of the C500Õs multiple datapointers can make external
bus accesses two times as fast as with a standard 8051 or 8051 derivative. Here, four data variables
in the internal RAM and two additional stack bytes were spared, too. This means for some
applications where all eight datapointers are employed that an C500 program has up to 24 byte (16
variables and 8 stack bytes) of the internal RAM free for other use.