AN1836 Motorola / Freescale Semiconductor, AN1836 Datasheet - Page 13

no-image

AN1836

Manufacturer Part Number
AN1836
Description
FLASH Programming for Motorola MC68HC912 Microcontrollers
Manufacturer
Motorola / Freescale Semiconductor
Datasheet
;- Step 5 -
;- Step 6 -
;- Step 7 -
YesFlag:
;- Step 9 -
;- Step 10 -
NoFlag:
SetMarginFlag:
Done:
;-----------------------------------------------------------------------
;-----------------------
;-----------------------------------------------------------------------
Error:
Blink:
AN1836
MOTOROLA
BSET
JSR
BCLR
JSR
TST
BEQ
DEC
TST
BNE
LDAA
CMPA
BNE
BCLR
INX
CMPA
BNE
BRA
INC
LDAA
CMPA
BEQ
LDAB
CMPB
BLS
BSR
INC
BRA
CLR
MOVB
MOVB
BRA
CLR
MOVB
MOVB
BSR
MOVB
BSR
BRA
Error Subroutine
FEECTL,ENPE
dly_22us
FEECTL,ENPE
dly_10us
MarginFlag
NoFlag
Npp
Npp
STEP4
FEEStart,X
DATA,X
Error
FEECTL,LAT
#$00
Loop
Done
Npp
FEEStart,X
DATA,X
SetMarginFlag ;If so, set the margin flag
Npp
#MAXNpp
STEP4
Error
MarginFlag
STEP4
PORTA
#$FF,DDRA
#PA1on,PORTA
*
PORTA
#$FF,DDRA
#PA0on,PORTA
dly_500ms
#$00,PORTA
dly_500ms
Blink
;Apply programming voltage (Set ENPE)
;Delay time for prog pulse (Tppulse)
;Remove programming voltage (Clear ENPE)
;Delay for high voltage turn off (Tvprog)
;Is MarginFlag set??
;If not, go bump counter and check data
;Decrement Npp
;Is Npp=0?
;If not, go to Step 4
;Read FEEPROM location to verify programming
;Is it the same as the byte to be programmed?
;Programming failed, output an error
;Clear LAT in FEECTL
;Check for $00 delimiter character
;If not, go back to start!
;If so, quit.
;Increment number of prog pulses applied
;Read FEEPROM location to verify programming
;Is it the same as the byte to be programmed?
;Have we applied max number of pulses?
;If not, continue programming
;If so, we have a problem
;Set MarginFlag
;Clear Port A
;Set DDRA to outputs
;Turn on PA1 to indicate complete
;(Turn off Vfp supply - programming complete)
;Clear Port A
;Set DDRA to outputs
;Turn PA0 on for error output
;Delay so blinking is visible (1/2 second between
; flashes)
;Turn PA0 off
;Repeat ad nauseam....
----------------------
Programming the FLASH Array
Application Note
13

Related parts for AN1836