English
Language : 

SAB88C166 Datasheet, PDF (21/58 Pages) Siemens Semiconductor Group – 16-Bit CMOS Single-Chip Microcontrollers with/without oscillator prescaler with 32 KByte Flash EPROM
SAB 88C166(W)
q Load source values and initialize loop counter (PCOUNT) with the maximum number of
programming trials (PNmax) to be performed before exiting the routine with a failure. Each trial
means applying a pulse of 100 µs to the selected words in the Flash memory. According to the
maximum cumulated programming time of 2.5 ms allowed per cell, PNmax must be ‘25’ here.
The doubleword at memory location [SRC_PTR] is loaded into two auxiliary registers DATAWR1
and DATAWR2.
q Program one doubleword stored in the auxiliary data registers to the Flash memory location
[FLASH_PTR]. FLASH_PTR is not incremented here, since in 32-bit programming mode the
hardware automatically arranges the two data words correctly. The execution of the second write
instruction automatically starts the programming of the entire double word.
This instruction sequence must not be interrupted.
MOV
MOV
[FLASH_PTR], DATAWR1
[FLASH_PTR], DATAWR2
; Write low word to Flash
; Write high word to Flash, starts programming
q Wait until programming time elapsed (100 µs in this example), which depends on bit field
CKCTL in the FCR register and on the CPU clock frequency. End of programming is detected by
polling the FBUSY flag in the FCR register. The Flash memory switches to PVM mode
automatically.
WAIT_PROG:
MOV R15, DPP1: pof FCR
JB
R15.2, WAIT_PROG
…
; Polling Loop to check bit FBUSY
; Read FCR contents using 16-bit access
; Loop while bit FBUSY (FCR.2) is ‘1’
; Continue in PVM mode, when FBUSY is ‘0’
q Verify VPP validity during programming to make sure VPP did not exceed its valid margins
during the programming operation. Otherwise programming may have not been performed
properly. The FCVPP flag is set to ‘1’ in case of this error condition. If FCVPP reads ‘1’, the
programming routine can abort, when VPP still fails, or repeat the programming operation, when
VPP proves to be stable now.
Semiconductor Group
20