
On-Chip FLASH Programming Routines, Rev. 4
24
Freescale Semiconductor
On-Chip Routines Source Code
On-Chip Routines Source Code
The following source code is for the MC68HC908LB8 on-chip routines. Because other MCUs support
different communication baud rates, GetBit and PutByte routines are slightly different. However, these
routines are built in the same manner.
.pagewidth 98t
;**********************************************************************
;* PURPOSE: This program has the HC908LB8 FLASH program, erase, verify
;* routines and serial communication routines.
;*
;* TARGET DEVICE: HC908LB8
;*
;* ASSEMBLER: P&E Microsystems CASM08Z
;* VERSION: 3.16
;*
;* GENERAL CODING NOTES:
;* A standard equate file "908LB86vXrY.inc" is used to define all MCU
;* register and bit names. Bit names use all uppercase characters.
;* BCLR, BSET, BRCLR, and BRSET use the bit name alone while logical
;* instructions such as ORA use the bit name with a prefix of
;* lowercase "m" which is a bit position mask.
;*********************************************************************
;*********************************************************************
;* ASSEMBLER DIRECTIVES
;* (BASE, MACROS, SETS, CONDITIONS, ETC.)
;*********************************************************************
base 10t ;Change default to decimal
;*********************************************************************
;* INCLUDED FILES
;*********************************************************************
$NOLIST
include "908LB8v0r2.inc"
$LIST
;*********************************************************************
;* EQUATES for ROM Assigned Locations
;*********************************************************************
;* ROM Assigned Location
;*
JumpTable: equ $037E ;jump table start address
FlashROM: equ JumpTable+$1B ;FLASH ROM start address
;*********************************************************************
;* EQUATES and VARIABLES for GetBit and PutByte routines
;* Constants used in the GetBit and PutByte routines:
;* NOTE: changing the following parameters will alter the baud rate!
;* External clock (Ext) values set for 9600 baud @ 2.4576MHz bus rate
;* Internal clock (Int) values set for 9600 baud @ 4.0MHz bus rate
;*********************************************************************
SampPerBitE: equ 22 ;samples per bit time (Ext)
SampPerBitI: equ 38 ;(Int) used in GetBit
OffsetE: equ 15 ;~70% SampPerBit (Ext) and (Int)
OffsetI: equ 27 ; used in GetBit