版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、<p><b> 外文翻譯</b></p><p> Serial Memories</p><p><b> Overview</b></p><p> Many of us like to use small, single chip micro controllers. They are relat
2、ively cheap, easy to wire up to make run, and over all just mighty convenient to use. One down side to using these single chip controllers is the lack of large amounts of memory. Sure, you can hook up external memory to
3、most of them, but that requires a lot of work, and usually consumes other valuable resources, mainly the I/O pins that make the chip useful.</p><p> There is help out there! There are several forms of memor
4、y that don't require the standard address bus and data bus wiring. These memories are called serial memories, and they are just the ticket to allow you to store large amounts of information without giving up those pr
5、ecious I/O lines. There are several different styles of serial EEPROM. The focus of this article is going to be SPI based devices. There are also 1, 2, and 3 wire serial EEPROM devices that function in a similar way, but
6、 have d</p><p> This article is going to introduce the basics of serial memories, and present the driver software needed to make it operate.</p><p> Missing the Bus</p><p> The b
7、ig advantage to using a Serial EEPROM is that the wiring only requires 4 signal lines from the CPU to operate it. Compare this with a more standard memory, which requires an address bus and a data bus! The amount of glue
8、 logic required to make a Serial EEPROM operate is extremely low. </p><p> For example, check out the following two packages. A traditional memory, such as a 27256, requires a 28-pin part to be wired into y
9、our circuit. There are 15 address lines, 8 output lines, plus assorted control lines. On the other hand, a serial EEPROM can be purchased using in a 8-pin package. There is 1 input line, 1 output line, 1 control line, an
10、d 1 clock line required. There are a couple of other control lines available, but are not actually required if you wish to avoid them. As you can ima</p><p> Of course, there are tradeoffs. Since the memory
11、 of the serial EEPROM is accessed one bit at a time, there is a speed penalty to be paid. However, these are still extremely fast parts. They can output their data at over 2 million bits per second, which is quite reason
12、able for many applications. So, for a small amount of software overhead and only 4 I/O pins, you can have yourself some substantial data storage!</p><p> Would you like to super Size that?</p><p&
13、gt; Serial EPROM’s are available in a variety of different sizes. They seem to range from 128 bytes all the way up to 32k bytes. Atmen also has a 128k byte device that fits the same form factor. All of these parts are e
14、lectrically compatible. However, some require minor software changes. For example, some allow writes of 32 bytes at a time, where others allow 64 bytes at a time. These minor differences are easily dealt with in software
15、. </p><p> It turns out that serial EPROM’s are available from several different manufacturers. At least two, Microchip and Atmen, have compatible chips. I haven't looked into the other manufacturers, b
16、ut I would expect theirs may be as well. </p><p> They are also available in several package sizes, including an 8pin DIP as well as SOIC surface mount. </p><p> The Basics</p><p>
17、; There are 8 pins on one of these parts. Here is a list and their functions</p><p> (* denotes active LOW)</p><p> The Block Diagram</p><p> As always, engineers love to see th
18、e block diagram! Here is the block diagram you will find in the documentation for the Microchip 25C640:</p><p> As you can see, there are a few different parts called out in the block diagram. Of particular
19、 interest to us are the EEPROM Array, which is the actual EEPROM memory cells, the Status Register, which is a register that holds configuration and status information, and of course the Page Latches, which are the tempo
20、rary 'holding' areas for data being written. The other parts are also interesting, but I am going to ignore them for this article. </p><p> A Schematic</p><p> Connecting a serial EEPR
21、OM is really quite straight forward. I have been offering a board based on the 68HC912B32 Micro controller for some time now. I recently added a spot for a serial EEPROM to the backside of the board. The following snippe
22、t of the schematic shows the 25xxx series EEPROM connected to the SPI port for this board. Note that on my 912B32 board, this is an optional device. I left several cut jumpers (these are areas where the trace can be cut,
23、 and the wiring done differently) on</p><p> Connecting up a serial EEPROM is pretty straight forward, and it can be added to almost any CPU that supports the SPI bus. Note that I have chosen to leave the W
24、P (Write Protect) and HOLD lines wired high. I don't use them in my software, but you are certainly welcome to use them. On my board, you merely cut the trace on the jumper, and wire up the appropriate pins to a port
25、 for control.</p><p> Table of commands</p><p> There are a small number of commands that you can issue to the serial EEPROM. The following table is a quick summary.</p><p> Each
26、 instruction code has its own argument requirements. Read/Write, for example, is followed by an address. Writing the status register requires an 8-bit argument, and so on. A complete set of instructions and their formats
27、 are available in the data sheet for your particular part. Most of these SPI parts have extremely similar manuals! You can find a list of data sheets on the Microchip website at which will provide you with a lot of
28、 extra detail.</p><p> Speed issues</p><p> Most parts can operate with transfer speeds in excess of 1 megabit per second. Some parts can go up to 8 megabits per second. You need to take this
29、into consideration when you are selecting a part. Luckily, most of the SPI implementations, such as the 68HC11 and 68HC12 SPI ports, allow you to adjust the clock speed for the SPI port with a clock scalar. Thus, if you
30、are connecting a 25LC640, for example, to a 16mhz 68HC12, you will need to select an SPI presale that slows the SPI bus down to 2mhz</p><p> Cycle life</p><p> Serial EPROM’s are typically rat
31、ed to endure 1 million write operations per byte. That’s pretty decent. However, you still need to be careful here that you are not constantly writing data to the part. EEPROM is not a substitute for general purpose RAM.
32、 If you write to these parts in a tight loop, it would only take an hour or so to exceed the 1million write operations. Your software needs to be written to take that into account. </p><p><b> Softwar
33、e</b></p><p> As you can see, wiring up an SPI based EEPROM to the SPI port is relatively simple. Nothing comes for free, however, and you will find the software commands needed to work with the SPI m
34、emory is a little more complex than just doing memory writes. </p><p> The basic operation of the SPI based EPROM’s is to lower the CS line, send a command, such as WRITE, followed by an address and the dat
35、a, then raise the CS line. In a WRITE operation, raising the CS line causes the EEPROM to actually store the data. That is an important point you don't want to miss!</p><p> Serial EPROM’s allow you to
36、write in 'page' mode, which means you can send up to 1 PAGE of data at a time. The number of bytes in a PAGE depends on the specific part. For example, the Atmen 25128 uses a 64 byte PAGE. The Microchip 25C640 us
37、es a 32 byte PAGE. The idea is that each time the address spans a PAGE boundary, you need to raise the CS line so that the chip can write is page into memory. </p><p> The key thing to watch for is when the
38、 address crosses that page boundary. You can write between one and the PAGE size bytes, which means if you only want to write a single byte that is fine. If you continue to write after crossing the page boundary, then th
39、e subsequent writes will wrap around on the current page and overwrite previously written data, which isn't what you wanted to do!</p><p> I have written a set of routines in Image craft 'C' tha
40、t deal with the serial EPROM’s. I have included links to the source below. </p><p> The software is structured in a simple way. There is an initialization routine, which sets up the SPI port appropriately.
41、It also defines read and write operations. </p><p> The read/write operations function the same basic way. You start the operation by calling the sermem_StartRead () function, giving the initial address. Th
42、en, you issue a series of sermem_Read () commands. When you are done, sermem_StopRead () is called. For ease of use, I have also defined a function called sermem_ReadBlock () that does the entire operation at once.</p
43、><p> The Write versions do the same basic functions. Here are the function prototypes from the sermon files: </p><p> // Sermem.h - Copyright 1998 (c) Kevin W Ross, all rights reserved</p>
44、<p><b> //</b></p><p> // Accompanies sermem.c and defines some of the basic information needed to</p><p> // Deal with the serial EEPROM memories.</p><p><
45、b> //</b></p><p><b> //</b></p><p> // Device Profiles - Here are the variables needed for each specific type of</p><p> // chip. Some have different page s
46、izes and data sizes</p><p><b> //</b></p><p> Void sermem_Initialize ();</p><p> Void sermem_StartRead (into address);</p><p> Void sermem_Read (unsigne
47、d char *puffin cuff);</p><p> Void sermem_StopRead (void);</p><p> Void sermem_ReadBlock (into address, unsigned char *puffin cuff);</p><p> Void sermem_StartWrite (into address)
48、;</p><p> Void sermem_Write (unsigned char *puffin cuff);</p><p> Void sermem_StopWrite (void);</p><p> Void sermem_WriteBlock (into address, unsigned char *puffin cuff);</p&g
49、t;<p> Void sermem_Fill (into address, unsigned char bitewing count);</p><p> You can find the full source code in sermem.c and sermem.h, which are fairly well commented and pretty easy to follow. T
50、his code is written for the 68HC12 series of chips, but is really trivial to port to the 68HC11 (an excursive left to the reader!). </p><p> Another file is called memtest.c, which is a test program that us
51、es the routines.</p><p> The Status Register</p><p> An important part of the serial EEPROM is the status register. I thought it important to point it out that you need to use this register. T
52、his register not only holds some configuration data that you will need to write to, it also contains an important bit called the WIP bit standing for "Write In Progress". Serial EEPROM requires a burn time whil
53、e it is saving data to the array. This can take up to 5 milliseconds, though it might be less. Rather than relying on a timer on your micro controller,</p><p> Void sermem_StopWrite (void)</p><p&
54、gt;<b> {</b></p><p><b> //</b></p><p> // Raise the CS line. That makes the memory part start its write cycle</p><p> // Then wait for the WIP bit to be
55、cleared</p><p><b> //</b></p><p><b> Do</b></p><p><b> {</b></p><p> spi_deselect ();</p><p> // Need to select th
56、e EEPROM for the read status operation</p><p> spi_select ();</p><p> Spinout (SERMEM_INST_RDSR);</p><p> // The Write in Progress (WIP) flag is bit 1. Wait for it to go low</
57、p><p> } While (spiting (SERMEM_INST_RDSR) & 0x01);</p><p> Spi_deselect ();</p><p> // Disallow further writes to the EEPROM. Prevents rouge clock signals</p><p>
58、 // From corrupting your data!</p><p> Sermem_WriteDisable ();</p><p><b> }</b></p><p> Above I show my implementation of the sermem_StopWrite () function. This funct
59、ions job is to cause the serial EEPROM to commit a previously transferred page to EEPROM. The function razes the CS line, and then issues a RDSR instruction and loops waiting for the WIP bit to go to zero. Note that the
60、spi_deselect () and spi_select () instructions needed to be there. The state transition is important because the CS line is used as the primary handshake between the micro controller that the serial EEP</p><p&
61、gt;<b> Summary</b></p><p> Serial EEPROM provide a great way to store non-volatile data on a small micro controller project. They require few I/O lines, relatively fast read/write operations, a
62、nd most operate from a single 5volt power supply. The software routines to drive these parts are not very complex. Next time you need to store some non-volatile data, such as configuration information or navigation maps,
63、 consider serial EEPROM.</p><p><b> 串行存儲(chǔ)器</b></p><p><b> 概述</b></p><p> 我們中的許多人喜歡使用小型的獨(dú)立芯片微控制器。它們相對(duì)較為便宜,容易接線運(yùn)行,而且最重要的是使用非常方便。使用這些微控制器的一個(gè)不好的方面是它們?nèi)狈Υ笕萘康拇鎯?chǔ)器。
64、當(dāng)然,你可以給它們中的大多數(shù)掛上外部存儲(chǔ)器,但是,那要做許多工作,而且通常要消耗其他有價(jià)值的資源,僅僅是那些輸入/出引腳使芯片變得有用。</p><p> 這里能提供幫助!有幾種形式的存儲(chǔ)器不需要標(biāo)準(zhǔn)地址總線和數(shù)據(jù)總線配線方式。這些存儲(chǔ)器稱為串行存儲(chǔ)器,它們?cè)试S你在不放棄那些珍貴的輸入/出引線的條件下,存儲(chǔ)大容量的信息。存在幾種不同形式的串行電擦除可編程存儲(chǔ)器。本文的焦點(diǎn)就是基于SPI(串行外圍接口)的器件。也
65、有1線,2線和3線式串行電擦除可編程存儲(chǔ)器器件,它們以相似的方式工作,但是具有不同的接口邏輯。</p><p> 本文將介紹串行存儲(chǔ)器的基礎(chǔ),并指出操作它所需要的驅(qū)動(dòng)軟件。</p><p><b> 總線不見(jiàn)了</b></p><p> 使用串行電擦除可編程存儲(chǔ)器的最大優(yōu)勢(shì)是:配線時(shí)僅僅需要CPU的4根信號(hào)線來(lái)操作。與此比較,一個(gè)較為標(biāo)準(zhǔn)
66、的存儲(chǔ)器將需要地址總線和數(shù)據(jù)總線!操作串行電擦除可編程存儲(chǔ)器所需要的組合邏輯數(shù)量是相當(dāng)?shù)偷摹?lt;/p><p> 例如,檢驗(yàn)以下兩個(gè)封裝。一個(gè)傳統(tǒng)的存儲(chǔ)器,像27256,需要28個(gè)引腳來(lái)接線到你的電路。其中有15條地址線,8條輸出線,還有多種控制線。另一方面,一個(gè)有8引腳封裝的串行電擦除可編程存儲(chǔ)器能夠買(mǎi)到。其中有1條輸入線,1條輸出線,1條控制線,還需要1條時(shí)鐘線。一些其他的控制線可能會(huì)用到,但是如果你希望不用
67、它們,那么實(shí)際上并不需要。正如你能想象到的,這更容易接線,更小巧,而且最大的好處是非常便宜!一個(gè)8kx8器件在DIGIKEY的價(jià)格是1.61美元。</p><p> 當(dāng)然,存在一些折中。由于串行電擦除可編程存儲(chǔ)器每次訪問(wèn)一個(gè)bit,這要付出速度上的代價(jià)。然而,它們?nèi)匀皇窍喈?dāng)快速的器件。它們能以每秒200萬(wàn)bit的速度輸出數(shù)據(jù)。這對(duì)于許多應(yīng)用來(lái)說(shuō)是很合適的。所以,對(duì)于小數(shù)量的軟件開(kāi)銷(xiāo)和僅僅4個(gè)I/O引腳,你可以為
68、自己存儲(chǔ)一些基本數(shù)據(jù)。</p><p> 你想要一個(gè)大一點(diǎn)的型號(hào)嗎?</p><p> 串行電擦除可編程存儲(chǔ)器有各種型號(hào)可供使用。它們從128字節(jié)一直到32K字節(jié)不等。與此對(duì)應(yīng),Atmen也有一個(gè)128K字節(jié)的器件。所有這些器件在電氣上都是兼容的。然而,一些器件需要有較小的軟件變化。例如,某些器件允許一次寫(xiě)32字節(jié),而其他的允許一次寫(xiě)64字節(jié)。這些較小的差別很容易在軟件中解決。<
69、/p><p> 顯然,串行電擦除可編程存儲(chǔ)器可以從幾個(gè)不同的廠商那里得到。至少兩個(gè),Microchip和Atmel,擁有兼容的芯片。我還沒(méi)有考察其他的廠商,但是可以預(yù)見(jiàn),它們的也同樣(兼容)。</p><p> 它們(EEPROM)也有幾種封裝型號(hào),包括一個(gè)8引腳雙列直插封裝以及SOIC。</p><p><b> 基礎(chǔ)部分</b></
70、p><p> 這些器件之一具有8個(gè)引腳。以下是引腳列舉和它們的功能。</p><p> (*表示低電平有效)</p><p><b> 方塊圖</b></p><p> 通常,工程師們愛(ài)看方塊圖!下面就是你在本文中找到的Microchip 25C640的方塊圖:</p><p> 正如你所看
71、到的,方塊圖里有一些不同的部分。對(duì)于我們尤其有趣的是EEPROM陣列(它實(shí)際上是EEPROM存儲(chǔ)單元),狀態(tài)寄存器(保存結(jié)構(gòu)和狀態(tài)信息),當(dāng)然還有頁(yè)鎖存(它是暫時(shí)保存當(dāng)前寫(xiě)入數(shù)據(jù)的區(qū)域)。其他部分也是有趣的,但是在這篇文章里我將忽略它們。</p><p><b> 一個(gè)示意圖</b></p><p> 連接一個(gè)串行EEPROM是很簡(jiǎn)單的。我提供一個(gè)基于68HC91
72、2B32微控制器的板子已有一段時(shí)間了。最近我在板子的背面為串行EEPROM添加了一塊地方。接下來(lái)示意的圖片展示了連接到板子SPI端口的25xxx串行EEPROM。注意,在我的912B32板子上,這是一個(gè)最優(yōu)器件。我在板子上留下了幾個(gè)切換開(kāi)關(guān)(在該區(qū)域,跟蹤能被切斷,配線方式不同)它們顯示在示意圖中。</p><p> 連上一個(gè)串行EEPROM太簡(jiǎn)單了,它能添加到幾乎所有的CPU,只要該CPU支持SPI總線。注意
73、,我已經(jīng)選擇將WP和HOLD線接為高電平。在我的軟件中,我不使用它們,但我歡迎你使用它們。在我的板子上,你僅僅在開(kāi)關(guān)上切斷跟蹤并為控制端口連接到合適的引腳就行了。</p><p><b> 命令表</b></p><p> 你可以發(fā)給串行EEPROM一些為數(shù)不多的命令。以下表格是一個(gè)簡(jiǎn)單的總結(jié)。</p><p> 每個(gè)指令編碼有它自己的格
74、式要求。例如Read/Write,緊接著它的是地址。寫(xiě)入狀態(tài)寄存器需要8bit的格式,等等。一套完整的指令及格式可以在你的特殊器件的數(shù)據(jù)手冊(cè)上得到。多數(shù)SPI器件具有相當(dāng)類(lèi)似的手冊(cè)!你能在下面的微芯片網(wǎng)址上找到數(shù)據(jù)手冊(cè)的列表,里面將給你提供大量的額外細(xì)節(jié)。 </p><p><b> 速度問(wèn)題</b></p><p> 多數(shù)器件能在傳輸速度超過(guò)1兆比特每秒的條件下
75、操作。當(dāng)你選擇了一個(gè)器件后需要將此考慮進(jìn)去。幸運(yùn)的是,多數(shù)SPI的執(zhí)行,例如68HC11和68HC12的SPI端口,允許你根據(jù)時(shí)鐘標(biāo)量來(lái)調(diào)整SPI端口的時(shí)鐘速度。所以,如果你連接的是25LC640,例如,連到16mhz的68HC12,那將需要選擇一個(gè)SPI比例因子來(lái)降低SPI總線到2mhz。這是個(gè)普通的疏忽,也是錯(cuò)誤的重要來(lái)源!</p><p><b> 使用壽命</b></p>
76、;<p> 串行EEPROM的典型值為每字節(jié)能承受一百萬(wàn)次寫(xiě)操作。這是相當(dāng)好的。然而,在這里你仍然需要注意,你并不是不斷地給器件寫(xiě)數(shù)據(jù)。EEPROM不是一般用途的RAM的替代品。如果你以一個(gè)短周期往這些器件(EEPROM)里寫(xiě)數(shù)據(jù),那將僅僅花費(fèi)一小時(shí)左右來(lái)超過(guò)一百萬(wàn)次寫(xiě)操作。你的軟件在寫(xiě)的時(shí)候需要將此考慮進(jìn)去。</p><p><b> 軟件</b></p>
77、<p> 正如你所見(jiàn)到的,基于EEPROM的SPI配線到SPI端口相對(duì)簡(jiǎn)單。沒(méi)有不需要代價(jià)的東西,然而,你將發(fā)現(xiàn)需要與SPI存儲(chǔ)器一起工作的軟件命令比存儲(chǔ)器寫(xiě)操作更為復(fù)雜。</p><p> 基于EEPROM的SPI基本操作是拉低CS線,發(fā)送一條命令,像WRITE,接著是地址和數(shù)據(jù),然后升高CS線。在一個(gè)WRITE操作中,升高CS線引起EEPROM存儲(chǔ)數(shù)據(jù)。這是你不想丟掉(數(shù)據(jù))的關(guān)鍵!</p
78、><p> 串行EEPROM允許你以頁(yè)模式進(jìn)行寫(xiě)操作,那意味著你每次能發(fā)送1頁(yè)數(shù)據(jù)。每頁(yè)的字節(jié)數(shù)取決于具體的器件。例如,Atmel 25128使用64字節(jié)的頁(yè)。微芯片25C640使用32字節(jié)的頁(yè)。思路是每次地址跨越一頁(yè),你需要升高CS線以便芯片能將一頁(yè)數(shù)據(jù)寫(xiě)入存儲(chǔ)器。</p><p> 觀察的關(guān)鍵是什么時(shí)候地址跨越頁(yè)邊界。你可以寫(xiě)一字節(jié)直到一頁(yè),那意味著如果你僅僅想寫(xiě)單個(gè)字節(jié),那沒(méi)問(wèn)題。如
79、果你在跨越頁(yè)邊界后繼續(xù)寫(xiě),那么后面的寫(xiě)操作將在當(dāng)前頁(yè)循環(huán)并覆蓋以前寫(xiě)過(guò)的數(shù)據(jù),那不是你要做的!</p><p> 我已經(jīng)在Image craft ‘C’下寫(xiě)過(guò)一套規(guī)則,用來(lái)處理處理串行EEPROM的問(wèn)題。我把如下資源的鏈接包括在內(nèi)了。</p><p> 該軟件以一個(gè)簡(jiǎn)單的方式構(gòu)造起來(lái)。有一個(gè)初始化過(guò)程,建立起合適的SPI端口。它也定義了讀和寫(xiě)操作。</p><p&g
80、t; 讀/寫(xiě)操作工作于相同的基本方式。你通過(guò)調(diào)用sermem_StartRead()函數(shù)開(kāi)始操作,同時(shí)要給出初始化地址。然后,你發(fā)出一系列sermem_Read()命令。當(dāng)你完成時(shí),sermem_StopRead()會(huì)被調(diào)用。為了使用容易,我還定義了一個(gè)稱為sermem_ReadBlock()的函數(shù),它能一次執(zhí)行全部操作。</p><p> 寫(xiě)翻譯執(zhí)行相同的基本功能。以下是sermon文件中的功能原型:<
81、;/p><p> // 配合 sermem.c文件,定義了一些需要的基本信息</p><p> // 處理串行EEPROM存儲(chǔ)器</p><p> // 器件聲明——這是每類(lèi)芯片需要的變量。其中一些具有不同的頁(yè)容量和數(shù)據(jù)//容量</p><p> Void sermem_Initialize ();</p><p>
82、; Void sermem_StartRead (into address);</p><p> Void sermem_Read (unsigned char *puffin cuff);</p><p> Void sermem_StopRead (void);</p><p> Void sermem_ReadBlock (into address,
83、unsigned char *puffin cuff);</p><p> Void sermem_StartWrite (into address);</p><p> Void sermem_Write (unsigned char *puffin cuff);</p><p> Void sermem_StopWrite (void);</p>
84、;<p> Void sermem_WriteBlock (into address, unsigned char *puffin cub);</p><p> Void sermem_Fill (into address, unsigned char bitewing count);</p><p> 你可以在sermem.c和sermem.h文件中找到所有源代碼,它
85、們已被相當(dāng)好地注釋?zhuān)苋菀桌斫?。這個(gè)代碼是為68HC12系列芯片寫(xiě)的,但是對(duì)于68HC11端口實(shí)在微不足道。</p><p> 另外一個(gè)文件稱為memtest.c,是使用該規(guī)則的一個(gè)測(cè)試程序。</p><p><b> 狀態(tài)寄存器</b></p><p> 串行EEPROM的一個(gè)重要部分就是狀態(tài)寄存器。我認(rèn)為,你需要使用該寄存器,指出這一
86、點(diǎn)是重要的。該寄存器不僅保持一些你寫(xiě)時(shí)需要的描述數(shù)據(jù),它還包括一個(gè)稱為WIP的重要bit,意思是“Write In Progress”。串行EEPROM在它往陣列里保存數(shù)據(jù)時(shí)需要一個(gè)爆發(fā)時(shí)間。盡管可以更短些,但這將花費(fèi)5毫秒。在你的微控制器上不是依靠一個(gè)計(jì)時(shí)器,你可以檢查WIP標(biāo)志位的狀態(tài),來(lái)獲知什么時(shí)候器件已經(jīng)結(jié)束寫(xiě)頁(yè)操作并為新數(shù)據(jù)做好了準(zhǔn)備。</p><p> Void sermem_StopWrite (
87、void)</p><p><b> {</b></p><p><b> //</b></p><p> // 升高CS信號(hào),導(dǎo)致存儲(chǔ)器開(kāi)始它的寫(xiě)周期</p><p> // 然后等待WIP位被清除</p><p><b> //</b>&l
88、t;/p><p><b> Do</b></p><p><b> {</b></p><p> spi_deselect ();</p><p> // 用來(lái)選擇EEPROM進(jìn)行讀狀態(tài)操作</p><p> Spi_select ();</p><
89、p> Spinout (SERMEM_INST_RDSR);</p><p> // 寫(xiě)入過(guò)程(WIP)標(biāo)志位為1。等它變低</p><p> } While (spiting (SERMEM_INST_RDSR) & 0x01);</p><p> spi_deselect ();</p><p> // 不允許對(duì)E
90、EPROM進(jìn)一步寫(xiě)入。阻止多余的時(shí)鐘信號(hào)打擾你的數(shù)據(jù)!</p><p> Sermem_WriteDisable ();</p><p><b> }</b></p><p> 以上我展示了sermem_StopWrite()函數(shù)的執(zhí)行。這個(gè)函數(shù)的工作是引起串行EEPROM提交一個(gè)之前傳輸過(guò)的頁(yè)。該函數(shù)升高CS線,然后發(fā)出一個(gè)RDSR指令
91、和循環(huán)等待WIP比特直到其為0。注意spi_deselect() 和spi_select()指令在此是必需的。狀態(tài)轉(zhuǎn)換之所以重要是因?yàn)镃S線在微控制器和串行EEPROM之間被用作主要的握手線。它是開(kāi)始和結(jié)束操作的信號(hào)。</p><p><b> 總結(jié)</b></p><p> 串行EEPROM為小型微控制器工程中存儲(chǔ)穩(wěn)定數(shù)據(jù)提供了一條極好的途徑。它們需要少量的I/
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 外文翻譯--存儲(chǔ)器的工作原理
- 計(jì)算機(jī)外文翻譯 -----大容量存儲(chǔ)器
- 存儲(chǔ)器類(lèi)型
- 存儲(chǔ)器習(xí)題
- 存儲(chǔ)器實(shí)驗(yàn)
- 存儲(chǔ)器教案
- 虛擬存儲(chǔ)器
- 存儲(chǔ)器擴(kuò)展
- 鐵電存儲(chǔ)器的技術(shù)背景外文翻譯@中英文翻譯@外文文獻(xiàn)翻譯
- 各類(lèi)存儲(chǔ)器介紹
- 靜態(tài)存儲(chǔ)器介紹
- (附件1)存儲(chǔ)器
- 直接存儲(chǔ)器存取
- 存儲(chǔ)器系統(tǒng)(6116)
- 存儲(chǔ)器擴(kuò)展實(shí)驗(yàn)
- 存儲(chǔ)器那點(diǎn)事
- 存儲(chǔ)器兼并之戰(zhàn)
- 4只讀存儲(chǔ)器和閃速存儲(chǔ)器
- 外文翻譯--帶有只讀存儲(chǔ)器的單片機(jī)集成電路
- 外文翻譯---帶有只讀存儲(chǔ)器的單片機(jī)集成電路
評(píng)論
0/150
提交評(píng)論