欢迎来到天天文库
浏览记录
ID:23306224
大小:47.00 KB
页数:21页
时间:2018-11-06
《atmel公司24系列eeprom编程举例》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、ATMEL公司24系列EEPROM编程举例作者:尘封往事文章来源:本站原创点击数:2043更新时间:2006-1-1213:07:34NAME Control_AT24Cxx;ThiscollectionofroutinesallowsanAT89C2051microcontrollertoread;andwritetheAT24CxxfamilyofserialCMOSEEPROMS.Thisversionofthe;codeiscompatibleonlywiththeAT89C2051duetothelocationofthe;databufferandstacki
2、nRAM.Thecodemaybemodifiedtoworkwiththe;AT89C1051byrelocatingorresizingthebufferandstacktofitintothe;smalleramountofRAMavailableintheAT89C1051.Notethattheminimum;sizeofthebufferisdeterminedbythepagesizeoftheAT24Cxx.;;AllfiveAT24Cxxdeviceoperationsaresupported.ByteWrite,Current;AddressReada
3、ndRandomReadareimplementedbythefunctionsWRITE_BYTE,;READ_CURRENTandREAD_RANDOM,respectively.PageWriteandSequentialRead;arespecialcasesoffunctionsWRITE_BLOCKandREAD_BLOCK,respectively.;WRITE_BLOCKandREAD_BLOCKprocessfromonebytetothenumberofbytes;inapageandtransferdatabetweentheAT24Cxxandth
4、eRAMbuffer.;;ThecodesupportsmultipleAT24Cxxdevicesperbus,eachwithaunique;addressdeterminedbythewiringoftheaddresspins(A0,A1,A2).The;three-bitprogrammableaddressispassedtotheWRITE_BYTE,READ_CURRENT,;READ_RANDOM,WRITE_BLOCKandREAD_BLOCKfunctions,whereitiscombined;withtheAT24Cxxfixedaddress(
5、FADDR)andusedtoaddressadeviceonthe;bus.RefertotheAT24Cxxfamilydatasheetsforadditionalinformationon;deviceaddressing.;;FunctionsBYTE_FILL,VERIFY_BYTE_FILL,PAGE_FILLandVERIFY_PAGE_FILLare;artifactsfromthedebugprocessandservetoillustratetheuseofthe;devicereadandwritefunctionswithanAT24C64.To
6、modifythecodefora;differentmemberoftheAT24Cxxfamily,simplyredefinethevaluesofSIZE;(thenumberofbytesperdevice)andPSIZE(thenumberofbytesperpage).;Tochangethefillvalue,redefineFILL.Tochangetheprogrammableportion;ofthedeviceaddress,redefinePADDRtoavaluefromzerotoseven.;;ThecodemeetsallAT24Cxx
7、familytimingrequirementswhenexecutedbyan;AT89Cx051microcontrollerwitha12MHzclock.Codemodificationsmaybe;requiredifafasterclockissubstituted.FADDR EQU 0a0h ;fixedaddressforAT24CxxEEPROMsPADDR EQU 0 ;programmableaddress(0..7)SIZE EQU 2000h ;bytesperAT24C64PSIZE
此文档下载收益归作者所有