1、外文翻译 Serial Memories Overview Many of us like to use small, single chip micro controllers. They are relatively 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 ho
2、ok up external memory to 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. There is help out there! There are several forms of memory that dont require the standard address bus and data bus wiring. These memor
3、ies 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
4、 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 Bus The big advantage to using a Serial EEPROM is that the wiring only r
5、equires 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
6、 as a 27256, requires a 28-pin 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 8-pin package. There is 1 input line, 1 output line, 1 control line, and 1 clock line required. T
7、here 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! An 8kx8 part costs about $1.61 at Dig key. Of course, there are tradeoffs. Since the me
8、mory 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 reasonable for many applications. So, for a small amount of software overhead and
9、only 4 I/O pins, you can have yourself some substantial data storage! Would you like to super Size that? Serial EPROMs 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 o
10、f these parts are electrically 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. It turns out that serial EPROMs are available from several
11、different manufacturers. At least two, Microchip and Atmen, have compatible chips. I havent looked into the other manufacturers, but I would expect theirs may be as well. They are also available in several package sizes, including an 8pin DIP as well as SOIC surface mount. The Basics There are 8 pin
12、s on one of these parts. Here is a list and their functions 1 CS Chip select. This is a critical pin on these parts. The CS line not only enables the part, but it also acts as the end of operation marker. More about this pin later 2 SO Serial Output pin. In SPI terminology, this would be the Slave O
13、ut, and should be connected to the MISO pin of the SPI port. Data being output from the serial EEPROM is clocked out on this line. 3 WP The WP pin allows for hardware write protection. If appropriate bits in the control register are set, then the WP pin will disable any write operations when the pin
14、 is held low. This would be appropriate when you want to have extra protection against software bugs, or when you intend for the part to be read only. The other option is to wire it high and leave it that way. 4 GND Power supply GND 5 SI Serial Input pin. In SPI terminology, this would be the Slave
15、In, and should be connected to the MOSI pin of the SPI port. Data being output by the CPU is clocked in on this line. 6 SCK Serial Clock. This is the SPI serial clock line. Each cycle of this clock causes the data registers to shift both in and out 1 bit. 7 HOLD This interesting pin places the state of the part on HOLD. This is useful if you have interrupt driven routines that need to access other parts on the SPI bus. By holding this line low, the part will ignore the SCK line, which in affect causes the part to hold its current state. Your interrupt routine can