![用單片機實現(xiàn)對SST39VF040的操作_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/22/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd1.gif)
![用單片機實現(xiàn)對SST39VF040的操作_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/22/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd2.gif)
![用單片機實現(xiàn)對SST39VF040的操作_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/22/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd3.gif)
![用單片機實現(xiàn)對SST39VF040的操作_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/22/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd4.gif)
![用單片機實現(xiàn)對SST39VF040的操作_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/22/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd/cd7477f8-5fdd-42c5-9300-e0b2c84cd0bd5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、.AT89C51對SST 之FLASH的編程操作詳述Flash又名閃存,屬于EEPROM,即電可擦除可編程的存儲器。由于具有電可擦除的特性,并且其數(shù)據(jù)可保留上百年,所以它的應用范圍非常廣泛。非常適用于作為MicroChip以及DSP的外部程序存儲器,或者作為需要存儲大量數(shù)據(jù)的外部EEPROM。SST公司設計之39系列Multi-Purpose Flash,按照其存儲的空間主要分以下幾種:64K x8/128K x8/256K x8/512K x8 Byte,各自代表的芯片型號有: 39系列Flash之特性: SST39LF512/010/020/040工作電壓為3.0-3.6V; SST39V
2、F512/010/020/040工作電壓為2.7V3.6V;數(shù)據(jù)保留時間100年;工作電流典型值為10mA,待機電流為1uA;快速擦除芯片時間為70ms,字節(jié)編程時間為14us。對芯片有如下操作:chip Erase operation ;sector Erase operation ;byte program operation ;byte read operation ;write operation status detection 。通過軟件對芯片的操作可以訪問到SST 制造商的ID;以及芯片的ID,各芯片ID如下表: TABLE 1: PRODUCT IDENTIFICATIONAd
3、dressDataManufacturers ID0000HBFHDevice IDSST39LF/VF512SST39LF/VF010SST39LF/VF020SST39LF/VF0400001H0001H0001H0001HD4HD5HD6HD7H注意:當通過軟件訪問了Product Identification后,必須采用軟件命令退出該模式才能對芯片進行擦除、讀寫的操作.下面給出各軟件操作指令的時序圖:1. WE控制的字節(jié)編程時序:2.CE控制的字節(jié)編程時序圖:3. 編程操作的狀態(tài)檢測時序圖:4.WE控制的扇區(qū)擦除時序圖:5. WE控制的芯片擦除時序圖:6. 軟件訪問ID的時序圖:7.
4、退出軟件訪問ID&復位命令的時序圖:根據(jù)上面的時序圖,下面給出各種軟件指令操作的流程圖:1字節(jié)編程流程圖:2讀取ID流程圖:3復位命令流程圖: 4芯片擦除命令流程圖:5扇區(qū)擦除命令流程圖:下面以SST39VF040為列,給出AT89C51對其做編程動作的source code:SST39VF040地址線為A0A18,數(shù)據(jù)線為DQ0DQ7,片選線CE,數(shù)據(jù)寫使能線WE,數(shù)據(jù)讀使能線OE。#define uchar unsigned char#define uint unsigned int#define ulong unsigned longsfr DataOut=0x80; /定義P0口接SS
5、T39VF040的數(shù)據(jù)線sfr Address7_0=0x90; /定義P1口接SST39VF040的地址線 A0A7sfr Address15_8=0xa0; /定義P2口接SST39VF040的地址線A8A15sbit Address16=P32; /定義P3.2接SST39VF040的地址線A16sbit Address17=P33; /定義P3.3接SST39VF040的地址線A17sbit Address18=P34; /定義P3.4接SST39VF040的地址線A18sbit Sst39vf040_Ce=P35; /定義P3.5接SST39VF040的片選線線CEsbit Sst3
6、9vf040_We=P36; /定義P3.6接SST39VF040的寫使能線WE sbit Sst39vf040_Oe=P37; /定義P3.7接SST39VF040的讀使能線OE struct Flash uchar manufacturer_id; uchar device_id; ulong address; Sst39vf040;/讀FLASH ID的函數(shù),入口參數(shù):FLASH的manfacturer_ID,device_ID,出口參數(shù)返回1,0uchar Read_Id(uchar manfa_id,uchar devi_id) Sst39vf040_Ce=1; Sst39vf040
7、_We=1; Address7_0=0x55;Address15_8=0x55;Sst39vf040_Oe=1;Sst39vf040_Ce=0;Sst39vf040_We=0;DataOut=0xaa;Sst39vf040_We=1;Address7_0=0xaa;Address15_8=0x2a; Delay10us();Sst39vf040_We=0;DataOut=0x55;Delay10us();Sst39vf040_We=1;Address7_0=0x55;Address15_8=0x55;Delay10us();Sst39vf040_We=0;DataOut=0x90;Sst39v
8、f040_We=1;Sst39vf040_Ce=1;Delay10us();Address7_0=0x00;Address15_8=0x00;Sst39vf040_Ce=0;Sst39vf040_Oe=0;DataOut=0xff;Sst39vf040.manufacturer_id=DataOut;Address7_0=0x01;Delay10us();Sst39vf040.device_id=DataOut;Sst39vf040_Ce=1; if(Sst39vf040.manufacturer_id=manuf_ID)&(Sst39vf040.device_id=devi_ID) retu
9、rn 1;else return 0;/退出讀ID的狀態(tài)以及命令FLASH復位的函數(shù)void Read_Id_Exit(void) Sst39vf040_Ce=1; Sst39vf040_Oe=0; Sst39vf040_We=1; Address7_0=0x55; Address15_8=0x55; Sst39vf040_Ce=0; Sst39vf040_Oe=1; Sst39vf040_We=0; Delay10us(); DataOut=0xaa; Sst39vf040_We=1; Delay10us(); Address7_0=0xaa; Address15_8=0x2a; Delay
10、10us(); Sst39vf040_We=0; Delay10us(); DataOut=0x55; Sst39vf040_We=1; Delay10us(); Address7_0=0x55; Address15_8=0x55; Delay10us(); Sst39vf040_We=0; Delay10us(); DataOut=0xf0; Sst39vf040_We=1; Sst39vf040_Ce=1; Delay10us(); Sst39vf040_Ce=0;/芯片擦除函數(shù)void Chip_Erase(void) Sst39vf040_Ce=1; Sst39vf040_Oe=0;
11、Sst39vf040_We=1; Address18=0; Address17=0; Address16=0; Address7_0=0x55; Address15_8=0x55; Sst39vf040_Ce=0; Sst39vf040_Oe=1; Sst39vf040_We=0; DataOut=0xaa; Delay10us(); Sst39vf040_We=1; Address7_0=0xaa; Address15_8=0x2a; Delay10us(); Sst39vf040_We=0; DataOut=0x55; Delay10us(); Sst39vf040_We=1; Addre
12、ss7_0=0x55; Address15_8=0x55; Delay10us(); Sst39vf040_We=0; DataOut=0x80; Delay10us(); Sst39vf040_We=1; Delay10us(); Sst39vf040_We=0; DataOut=0xaa; Delay10us(); Sst39vf040_We=1; Address7_0=0xaa; Address15_8=0x2a; Delay10us(); Sst39vf040_We=0; DataOut=0x55; Delay10us(); Sst39vf040_We=1; Address7_0=0x
13、55; Address15_8=0x55; Delay10us(); Sst39vf040_We=0; DataOut=0x10; Delay10us(); Sst39vf040_We=1; while(!Wait_Data_Pulling();/檢測FLASH編程,擦除操作過程中是否完成的函數(shù),完成后返回值1 uchar Wait_Data_Pulling(void) uchar outdata; Sst39vf040_Ce=1; Sst39vf040_We=1; Sst39vf040_Oe=1; Delay10us(); Sst39vf040_Ce=0; Sst39vf040_Oe=0;
14、Delay10us(); DataOut=0xff; outdata=DataOut; Sst39vf040_Ce=1; Sst39vf040_Oe=1; if(outdata&0x80)=0x80) return 1; else return 0; /字節(jié)編程函數(shù),入口參數(shù):( byte_address:AmsA0 = A18A0 ,待寫的數(shù)據(jù):byte_data ), void We_Byte_Program(ulong byte_address,uchar byte_data) ulong temp_address; Sst39vf040_Ce=1; Sst39vf040_Oe=0; S
15、st39vf040_We=1; Address7_0=0x55; Address15_8=0x55; Address16=0; Address17=0; Address18=0; Sst39vf040_Ce=0; Sst39vf040_Oe=1; Sst39vf040_We=0; DataOut=0xaa; Delay10us(); Sst39vf040_We=1; Address7_0=0xaa; Address15_8=0x2a; Delay10us(); Sst39vf040_We=0; DataOut=0x55; Delay10us(); Sst39vf040_We=1; Addres
16、s7_0=0x55; Address15_8=0x55; Delay10us(); Sst39vf040_We=0; DataOut=0xa0; Delay10us(); Sst39vf040_We=1; temp_address=byte_address; Address7_0=temp_address&0x0000ff; temp_address=byte_address; Address15_8=(temp_address&0x00ff00)8; temp_address=byte_address; if(temp_address&0x010000)!=0) Address16=1; e
17、lse Address16=0; temp_address=byte_address; if(temp_address&0x020000)!=0) Address17=1; else Address17=0; temp_address=byte_address; if(temp_address&0x040000)!=0) Address18=1; else Address18=0; Delay10us(); Sst39vf040_We=0; DataOut=byte_data; Delay10us(); Sst39vf040_We=1; while(!Wait_Data_Pulling();/
18、字節(jié)讀函數(shù) 入口參數(shù):待讀的字節(jié)地址byte_address,返回參數(shù)值:讀出的數(shù)據(jù)uchar Byte_Read(ulong byte_address) ulong temp_address; uchar temp_data; temp_address=byte_address; Sst39vf040_Ce=1; Sst39vf040_Oe=1; Sst39vf040_We=1; Address7_0=temp_address&0x000000ff; temp_address=byte_address; Address15_8=(temp_address&0x0000ff00)8; temp_address=byte_address; if(temp_address&0x00010000)!=0) Address16=1; else Address16=0; temp_address=byte_address; if(temp_address&0x00020000)!=0) Address17=1; else Address17=0; temp_address
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年債權(quán)出售及受協(xié)議書范文參考
- 2025年國內(nèi)旅游合作合同標準格式
- 2025年企業(yè)與股東資金互助協(xié)議
- 2025年保險賠付責任權(quán)益協(xié)議
- 2025年官方版復婚雙方解除婚姻策劃協(xié)議書
- 2025年人力資源與組織績效評估合同
- 2025年度人工智能策劃投資協(xié)議書
- 2025年古建筑保護工程進度申請監(jiān)管協(xié)議
- 2025年二手房產(chǎn)一次性付款交易合同模板
- 2025年債券交易委托策劃協(xié)議書
- 最新變態(tài)心理學課件
- 《民航飛機自動飛行控制系統(tǒng)》課件合集
- 工程洽商記錄表格
- 橋梁施工常見問題及預防控制要點(PPT,46)
- 中俄文一般貿(mào)易合同范本
- 2021最新版三年級下冊生命-生態(tài)-安全教案
- 【自考練習題】石家莊學院概率論與數(shù)理統(tǒng)計真題匯總(附答案解析)
- 市政管道頂管施工技術(shù)的發(fā)展歷史(45頁)
- 依戀理論之母嬰依戀
- 電氣CAD-電氣圖基本知識
- 混合痔的治療PPT課件
評論
0/150
提交評論