bclr 4,porta
bclr 5,porta ;LEDs off
rts
;-------- WRITE TO EEPROM Routines ----------------------------------
; wrflash: burns A into flash at location pointed by H:X
; -------
wrflash: sthx flshadr
;this is the address in the flash
sta flshbyt ;and the byte we want to put there
tsx
sthx memSP ;store SP in memSP, so it can be temporarily used as a 2nd index register
ldhx #ramfree+1 ;SP now points to RAM (remember to add 1 to the address!!!, HC08 quirk)
txs ;SP changed (careful not to push or call subroutines)
ldhx #ersflsh ;H:X points to beginning of flash programming code
doall: lda 0,x ;get 1st byte from flash
sta 0,sp ;copy it into RAM
aix #$0001 ;HX:=HX+1
ais #$0001 ;SP:=SP+1
cphx #lastbyt
;and continue until we reach the last byte
bne doall
ldhx memSP ;once done, restore the SP
txs
jsr ramfree ;and run the subroutine from RAM, you cannot write the flash while
rts ;running a code in it, so the RAM has to take over for that piece
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;*************** THE FOLLOWING CODE WILL BE COPIED INTO AND WILL RUN FROM RAM ******
ersflsh: lda #$02 ;textbook way to erase flash
sta flcr
lda flbpr
clra
ldhx flshadr
sta 0,x
bsr delayf
lda #$0A
sta flcr
bsr delayf
lda #$08
sta flcr
bsr delayf
clra
sta flcr
bsr delayf
pgmflsh: lda #$01 ;textbook way to program flash
sta flcr
lda flbpr
clra
ldhx flshadr
sta 0,x
bsr delayf
lda #$09
sta flcr
bsr delayf
lda flshbyt
ldhx flshadr
sta 0,x
bsr delayf
lda #$08
sta flcr
bsr delayf
clra
sta flcr
AN1950
Sensors
18
Freescale Semiconductor
相关PDF资料
KN500B1/4 SWITCH KNOB STRAIGHT .50" BLACK
KN5700B1/4 SWITCH KNOB STRAIGHT .75" BLACK
KN700B1/4 SWITCH KNOB STRAIGHT .75" BLACK
KS-100 PROTECTIVE COVER FOR RELAYS
KTKK-0500 CONN HEAT SHRINK TUBE SZ 8 STR
KTKK-0674 CONN HEAT SHRINK TUBE SZ E STR
KTKK-1123 CONN HEAT SHRINK TUBE SZ D ANG
KTR10EZPJ302 RES 3.0K OHM 1/8W 5% 0805 SMD
相关代理商/技术参数
KITMPXA6115AEVB 功能描述:压力传感器开发工具 Sensor Toolbx Pressu Sensor Developmt brd RoHS:否 制造商:Freescale Semiconductor 工具用于评估:MPL3115A2 接口类型:USB 最大工作温度:
KITMPXSHOWEVK 功能描述:压力传感器开发工具 PRESSURE SHOWBOARD RoHS:否 制造商:Freescale Semiconductor 工具用于评估:MPL3115A2 接口类型:USB 最大工作温度:
KITMPXV5004DPEVB 功能描述:压力传感器开发工具 MPXV5004 Dev Kit RoHS:否 制造商:Freescale Semiconductor 工具用于评估:MPL3115A2 接口类型:USB 最大工作温度:
KITMS05051 功能描述:电容套件 0.2pF-1.0pF 0505 10 EA-8 VALUES RoHS:否 制造商:Nichicon 电容范围:10 uF to 680 uF 公差范围: 电压范围:6.3 V to 25 V 产品:Aluminum Organic Polymer Capacitor Kit
KITMS05052 功能描述:电容套件 1.5pF-22pF 0505 10 EA-8 VALUES RoHS:否 制造商:Nichicon 电容范围:10 uF to 680 uF 公差范围: 电压范围:6.3 V to 25 V 产品:Aluminum Organic Polymer Capacitor Kit
KITMS05053 功能描述:电容套件 27pF-330pF 0505 10 EA-8 VALUES RoHS:否 制造商:Nichicon 电容范围:10 uF to 680 uF 公差范围: 电压范围:6.3 V to 25 V 产品:Aluminum Organic Polymer Capacitor Kit
KITMS06031 功能描述:电容套件 0.1pF-1.0pF 0603 10 EA-8 VALUES RoHS:否 制造商:Nichicon 电容范围:10 uF to 680 uF 公差范围: 电压范围:6.3 V to 25 V 产品:Aluminum Organic Polymer Capacitor Kit
KITMS06032 功能描述:电容套件 1.5pF-22pF 0603 10 EA-8 VALUES RoHS:否 制造商:Nichicon 电容范围:10 uF to 680 uF 公差范围: 电压范围:6.3 V to 25 V 产品:Aluminum Organic Polymer Capacitor Kit