Initial
This commit is contained in:
73
as68hc11/code/eeprom.asm
Normal file
73
as68hc11/code/eeprom.asm
Normal file
@@ -0,0 +1,73 @@
|
||||
; AUTHOR: SEAN KESSLER DATE:01/10/2001
|
||||
; PROGRAM: EEPROM.ASM
|
||||
; PLATFORM:M68HC11E2FN
|
||||
; LANGUAGE:CUSTOM ASSEMBLER
|
||||
; FUNCTION:TEST EEPROM READ/WRITE
|
||||
|
||||
RAM equ 00000h ; base of code
|
||||
RAMSIZE equ 000FFh ; extent of RAM
|
||||
STACK equ RAM+RAMSIZE ; stack expands down from end of RAM
|
||||
PORTB equ 01004h ; address of PORTB register
|
||||
EEPROM equ 0F800h ; start of EEPROM
|
||||
PPROG equ 0103Bh ; PPROG register
|
||||
EEPGM equ 00003h ; EEPROM Programming Voltage Enable
|
||||
EELAT equ 00002h ; EEPROM Latch Control
|
||||
org RAM ; base of code
|
||||
BEGIN equ *
|
||||
lds STACK ; initialize the stack
|
||||
START equ * ; start sync address
|
||||
loop equ *
|
||||
|
||||
ldab 01h ; move 1 into register b
|
||||
stab [PORTB] ; light b0
|
||||
bsr DELAY100
|
||||
; bsr DELAY1K ; pause
|
||||
|
||||
ldab 02h ; move 2 into register b
|
||||
stab [PORTB] ; light b1
|
||||
bsr DELAY100
|
||||
; bsr DELAY1K ; pause
|
||||
|
||||
jmp loop
|
||||
|
||||
END equ * ; need to figure out how to enable stop
|
||||
jmp END ; do it forever
|
||||
; ********************* write data to EEPROM location ******************************
|
||||
EEPROMW equ * ; register a contains data, x contains eeprom address
|
||||
ldab EELAT ; move EELAT enable into register b
|
||||
stab [PPROG] ; move EELAT enable into PPROG register
|
||||
staa ix,0 ; store contents of register a into EEPROM address at ix
|
||||
ldab EEPGM ; move EEPGM enable bit into register b
|
||||
stab [PPROG] ; move EEPGM enable bits into PPROG register
|
||||
bsr DELAY10 ; allow charge pump to charge
|
||||
clr [PPROG] ; turn off high voltage & set to read mode
|
||||
rts
|
||||
; ********************** DELAY ROUTINES ************************
|
||||
DELAY10 equ * ; 10ms delay @ 2.1 mhz
|
||||
pshy ; save register y
|
||||
ldy 0BB8h ; load loop counter into y register
|
||||
DELAY10LOOP equ * ; loop counter sync address
|
||||
dey ; decrement counter
|
||||
bne DELAY10LOOP ; loop until zero in y
|
||||
puly ; restore register y
|
||||
rts ; return to caller
|
||||
DELAY1K equ * ; 1000ms delay @ 2.1 mhz
|
||||
pshy ; save register y
|
||||
ldy 0Ah ; load 10d into register y
|
||||
DELAY1KLP equ * ; loop counter sync address
|
||||
bsr DELAY100 ; call 100 ms delay
|
||||
dey ; decrement register y
|
||||
bne DELAY1KLP ; continue
|
||||
puly ; restore register y
|
||||
rts ; return to caller
|
||||
DELAY100 equ * ; 100 ms @ 2.1 mhz
|
||||
pshx ; save register x
|
||||
ldx 07530h ; load loop counter into register x
|
||||
DELAY100LP equ * ; loop counter sync address
|
||||
dex ; decrement register x
|
||||
bne DELAY100LP ; continue
|
||||
pulx ; restore register x
|
||||
rts ; return to caller
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user