AN2183 Freescale Semiconductor / Motorola, AN2183 Datasheet - Page 32

no-image

AN2183

Manufacturer Part Number
AN2183
Description
Using FLASH as EEPROM on the MC68HC908GP32
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
;
;
;
ClearRAM:
;
;
;
;
;*
;*
;*
;*
;*
;*
;*
;*
;*
cmd_read:
cmd_erase:
cmd_write:
cmd_dump:
;
main:
;
;
;
;
Check_Read:
;
32
Clear all RAM.
Initialize Port I/O and Variables
Main Control Loop
Interface commands:
Check for Read command and execute.
ldhx
clr
aix
cphx
bne
mov
mov
mov
mov
cli
’W’
’R’
’D’
’E’
ldhx
jsr
jsr
cmp
beq
jsr
and
cmp
bne
jsr
jsr
cmp
beq
cmp
beq
jmp
= write following sting into FlashEE
= read back current FlashEE block data
= dump entire FlashEE
= erase entire FlashEE
#ram_start
,x
#1
#ram_last+1
ClearRAM
#init_scc1,scc1
#init_scc2,scc2
#init_scc3,scc3
#init_scbr,scbr
equ
equ
equ
equ
#msg_hello
PrintString
GetChar
#ascii_CR
main
PutChar
#$DF
#cmd_read
Check_Erase
GetChar
PutChar
#’1’
Check_Read1
#’2’
Check_Read2
Check_What
**********************************************************************
’R’
’E’
’W’
’D’
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
====================================================
; point to start of RAM
; clear RAM location
; advance pointer
; done ?
; loop back if not
; initialize SCI Control Register 1
; initialize SCI Control Register 2
; initialize SCI Control Register 3
; initialize SCI Baud Rate Register
; enable all interrupts
; Read command
; Erase command
; Write command
; Dump command
; point to hello message
; output it
; get a character from the SCI
; check for ASCII carriage return
; just loop back if so
; else, echo character back
; convert to uppercase
; check for Read command
; skip if not
; get a character from the SCI
; echo character back
; check if target is 1st FlashEE
; continue if so
; check if target is 2nd FlashEE
; continue if so
; else, respond to unknown command
MOTOROLA
AN2183

Related parts for AN2183