English
Language : 

MC68HC908RK2 Datasheet, PDF (38/158 Pages) Motorola, Inc – Microcontroller Unit
Memory
defined) upon subsequent calls. The number of rows is the difference between the value in H:X and
LADDR, divided by 8.
A row is the minimum range that can be programmed with the REDPROG routine. All rows in the range
will be programmed once before any are programmed again. This approach is taken to ensure that all
rows reach the end of lifetime at approximately the same time.
A special bit will be maintained by the routine, called a cycling bit, in each row. This bit is used to ensure
that the data is programmed to all the rows defined in the range. This is the high bit of the first byte in each
row. This bit cannot be used to store user data. It will be modified by the REDPROG routine. This is at bit
7 of the byte at address DATA+0.
To determine which row to program, the algorithm will step from the first to the last row in a range looking
for the first row whose cycling bit is different from the first. If all rows contain the same cycling bit, then the
first row will be used.
The row whose cycling bit is different will be erased and the entire row will be programmed with the given
data, including a toggled version of the cycling bit.
2.5.8.5 Example Routine Calls
This code is for illustrative purposes only and does not represent valid syntax for any particular assembler.
RAM
EQU
$80
RDVRRNG
EQU
$F000
PRGRNGE
EQU
$F003
ERANRGE
EQU
$F006
REDPROG
EQU
$F009
;*************************************************************
RAM Definitions for Subroutines
;**************************************************************
ORG
RAM+8
CTRLBYT
CPUSPD
LADDR
BUMPS
DERASE
RMB
1
RMB
1
RMB
2
RMB
1
RMB
2
;Allocation of “DATA” space is dependent on the device and ;application
DATA RMB
8
;*************************************************************
; CALLING EXAMPLE FOR READ/VERIFY A RANGE (RDVRRNG)
;**************************************************************
LDA #$FF
;TARGET IS RAM
LDHX #$7807
;END AFTER FIRST ROW
STHX LADDR
LDHX #$7800
;START AT FIRST ROW
JSR
RDVRRNG
;DATA WILL CONTAIN FLASH INFO
MC68HC908RK2 Data Sheet, Rev. 5.1
38
Freescale Semiconductor