SST89C58电子盘电路及代码

[10-10 20:38:44]   来源:http://www.88dzw.com  微机|单片机   阅读:8488

文章摘要:movSFAL, #low(FlashAddrs)orlSFCF, #40h; set IAPEN=1 to enable IAPread:movxa,@dptr; read 1 byte data from ADCmovSFDT, a; program into on-chip flashmovSFCM, #0Eh; issue Byte-Program commandacallDone?; wait until donemova,SFAL; adjust the address of flashadda,#1movSFAL, amova,SFAHaddca,#0movSFAH, adjnz

SST89C58电子盘电路及代码,标签:电路设计,http://www.88dzw.com

movSFAL, #low(FlashAddrs)

orlSFCF, #40h; set IAPEN=1 to enable IAP

read:movxa,@dptr; read 1 byte data from ADC

movSFDT, a; program into on-chip flash

movSFCM, #0Eh; issue Byte-Program command

acallDone?; wait until done

mova,SFAL; adjust the address of flash

adda,#1

movSFAL, a

mova,SFAH

addca,#0

movSFAH, a

djnzB,read

djnzR7, read

anlSFCF, #0BFh; disable IAP

ret

;========================================

Compare:movdptr,#message;point to message

movSFAH,#high(FlashAddrs)

movSFAL,#low(FlashAddrs)

orlSFCF, #40h; IAPEN=1

clrF0

movR7,#2

movB,#0

verify:clra

movca,@a dptr; getoriginal data in message

incdptr

movSFCM, #0Ch; issue BYTE-VERIFY command

nop

xrla, SFDT; SFDT contains datain flash, these data come from ADC

jzskip

setbF0; set flag F0 (PSW.5) if any discrepancy.

skip:mova,SFAL; increase the address of flash

adda,#1

movSFAL, a

mova,SFAH

addca,#0

movSFAH, a

djnzB,verify

djnzR7, verify

anlSFCF, #0BFh; disable IAP

ret

;========================================================================

message:DB"This demo program demonstrates how easy to design "

DB"SST ATA-Disk Chip into SST FlashFlex51 embedded microcontroller. "

DB"After you understand how to use the basic WriteSector and ReadSector "

DB"functions, it's easy to try any others."

DB"The hardware connection between ADC and MCU is also very simple,"

DB"just like you expand any I/O or data memory in your application system. "

DB"After power-on, ADC is default to be 16 bit operation as all EIDE "

DB"standards, firmware needs enable 8 bit operation before "

DB"further write / read operation."

end

上一页  [1] [2] [3] [4] 


Tag:微机|单片机电路设计家电维修 - 单元电路介绍 - 微机|单片机