| 数据搜索系统,热门电子元器件搜索 |
|
MPXM2010D 数据表(PDF) 18 Page - Freescale Semiconductor, Inc |
|
|
|||||||||||||||||||||||||||||
MPXM2010D 数据表(HTML) 18 Page - Freescale Semiconductor, Inc |
|
18 / 24 page ![]() AN1950 Sensors 18 Freescale Semiconductor 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 |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |