【正文】
e,緊接著它的是地址。這是個(gè)普通的疏忽,也是錯(cuò)誤的重要來源!使用壽命串行EEPROM的典型值為每字節(jié)能承受一百萬次寫操作?;贓EPROM的SPI基本操作是拉低CS線,發(fā)送一條命令,像WRITE,接著是地址和數(shù)據(jù),然后升高CS線。你可以寫一字節(jié)直到一頁,那意味著如果你僅僅想寫單個(gè)字節(jié),那沒問題。然后,你發(fā)出一系列sermem_Read()命令。Void sermem_StopRead (void)。這個(gè)代碼是為68HC12系列芯片寫的,但是對于68HC11端口實(shí)在微不足道。Void sermem_StopWrite (void){ // // 升高CS信號(hào),導(dǎo)致存儲(chǔ)器開始它的寫周期 // 然后等待WIP位被清除 // Do { spi_deselect ()。阻止多余的時(shí)鐘信號(hào)打擾你的數(shù)據(jù)! Sermem_WriteDisable ()。它們需要少量的I/O線,相對較快的讀寫操作,多數(shù)在單一5V供電電源下運(yùn)行。它是開始和結(jié)束操作的信號(hào)。 spi_deselect ()。盡管可以更短些,但這將花費(fèi)5毫秒。Void sermem_Fill (into address, unsigned char bitewing count)。Void sermem_StartRead (into address)。讀/寫操作工作于相同的基本方式。思路是每次地址跨越一頁,你需要升高CS線以便芯片能將一頁數(shù)據(jù)寫入存儲(chǔ)器。軟件正如你所見到的,基于EEPROM的SPI配線到SPI端口相對簡單。幸運(yùn)的是,多數(shù)SPI的執(zhí)行,例如68HC11和68HC12的SPI端口,允許你根據(jù)時(shí)鐘標(biāo)量來調(diào)整SPI端口的時(shí)鐘速度。以下表格是一個(gè)簡單的總結(jié)。接下來示意的圖片展示了連接到板子SPI端口的25xxx串行EEPROM。通常接5V。6SCK串行時(shí)鐘。從串行電擦除可編程存儲(chǔ)器輸出的數(shù)據(jù)在此線上隨時(shí)鐘輸出?;A(chǔ)部分這些器件之一具有8個(gè)引腳。所有這些器件在電氣上都是兼容的。由于串行電擦除可編程存儲(chǔ)器每次訪問一個(gè)bit,這要付出速度上的代價(jià)。例如,檢驗(yàn)以下兩個(gè)封裝。這里能提供幫助!有幾種形式的存儲(chǔ)器不需要標(biāo)準(zhǔn)地址總線和數(shù)據(jù)總線配線方式。 0x01)。Void sermem_Write (unsigned char *puffin cuff)。t what you wanted to do!I have written a set of routines in Image craft 39。t plan on doing this, just wire it high.8VCCThe power supply line. Usually connected to +5 volts, though the range of voltages go as low as , depending on the part you are using(* denotes active LOW)The Block DiagramAs always, engineers love to see the block diagram! Here is the block diagram you will find in the documentation for the Microchip 25C640:As you can see, there are a few different parts called out in the block diagram. Of particular 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 temporary 39。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 precious 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 have different interface logic.This article is going to introduce the basics of serial memories, and present the driver software needed to make it operate.Missing the BusThe big 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 logic required to make a Serial EEPROM operate is extremely low. For example, check out the following two packages. A traditional memory, such as a 27256, requires a 28pin part to be wired into your 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 8pin package. There is 1 input line, 1 output line, 1 control line, and 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 imagine, these parts a lot easier to wire in, much smaller and best of all are mighty cheap!t use them in my software, but you are certainly wele to use them. On my board, you merely cut the trace on the jumper, and wire up the appropriate pins to a port for control.Table of mandsThere are a small number of mands that you can issue to the serial EEPROM. The following table is a quick summary.Instruction Instruction CodeDescriptionREAD0000 0011Read data from memory array beginning at selected addressWRITE0000 0010Write data to memory array beginning at selected addressWREN0000 0110Set the write enable latch (enable writing)WRDI00