|Shopping Cart Download Website|
|You are here: 8051 Tools Development Board Schematic & Parts|
Schematic Drawing, 8051 Development Board, Rev 5Use this high quality (600 dpi) PDF for printing.
This schematic is provided in the hope that it will be useful, but without any warranty, not even a warranty of merchantability or fitness for a particular purpose.
The address bus in this schematic is connected in an unusual way, which is optimized for simpler point-to-point wiring and board layout. For anyone building the board using wire-wrap or hand soldered point to point construction, this wiring scheme makes for much less clutter in the wiring if the chips are positioned similarly to the layout on the printed circuit board.
This unusual address bus wiring works. The 74HC373 chip (U2) is 8 identical flip-flops, so it does not matter which one is used for each line. On the RAM (U3) and Flash ROM (U4) chips, all data that is stored in these chips is written by the 87C52 chip (U1), so it does not matter which physical location within the chip is mapped into each location within the CPU's address space, because each read from these chips will return the same data that was written from a previous write.
Some readers have felt that it's "just not natural" to connect any other way than P0.0-D0-Q0-A0, P0.1-D1-Q1-A1, and so on, but it does indeed work. For a historic example, Woz used a very creative address bus connection scheme in the Apple ][ to automatically do DRAM refresh with his video refresh reads. Because he arranged the address pins a certain unusual way, every video mode accessed each DRAM row several times per video refresh, so he didn't need to add the cost and space of the usual DRAM refresh circuits (he interleaved video and cpu memory access, since the 6502 spends half its time not fetching anything). It works, and Apple sold millions of them!
The A15 signal goes directly to the RAM, so the RAM gets selected for all addresses where A15 is low (0000 to 7FFF). A11 to A14 go to a 4-input NAND gate. That gate outputs low when all four signals are high, and its output is low in all other cases. That gate and the A15 signal go to the other 4-input NAND gate and to the 74HC138 chip. When A15 is high, and any of A11 to A14 are low, the other 4-input NAND gate drives the flash rom chip select low. That means the flash rom is enabled from the range 8000 to F7FF. Those same two signals also go to the 74HC138 chip's G1 and G2a inputs. The 74HC138 only drives one of its outputs low when G1 is high and when G2a is low. That means the 74HC138 chip drives one of its 8 signals in the range of F800 to FFFF. The three address inputs to the 74HC138 are connected to A8, A9 and A10, so that each of those signals corresponds to a 256 byte range. If you follow where each one goes, you'll see they correspond to the memory map for the periperals.
Most of the chips are designed to connect directly to the bus, so all that's needed is to connect their address pins to the lower pins of the address bus, their data pins to the data bus, and their write and output enable pins to the WR and RD/PSEN signals. All the chips see all those signals, but only the chip that gets a low signal on its chip select pin will communicate with the processor. All the other chips remain silent. The 8051 provides the address information before it asserts RD, WR or PSEN to cause the chip to communicate, and the logic gates are chosen so that the chip select signals are generated before the 8051 strobes on of those control signals.
The LCD is the one device that is a bit different. Most bus interface devices require the address signals first, then the chip select, and then the RD or WR control signal. The LCD instead requires its address (register/data select), read/write select, and data signals first. Then an active-high enable signal is given to the LCD to make it execute the bus cycle. To accomplish this, the R/W signal of the LCD is connected to an address pin, as is the RS (regsiter/data select). This way those signals are asserted first and maintained throughout the bus cycle. This means that separate memory locations must be used to read from and write to the LCD. The three control signal are AND'd together and fed to a NOR gate with the active-low chip select, so that the LCD will get an active high enable signal that begins well after the address pins are stable (as is required by most common LCDs).
The most important factor is that the 8051 processor has a 16 bit address space. This means the processor can never "see" more than 64k of memory. Actually, the 8051 has three memory spaces, 256 bytes of internal RAM, and two 64k byte external spaces, one for data and the other for executable code. The executable code space is read-only (PSEN signal), so there is really only one writable 64k address space. This design uses an AND gate (74AC08) to combines the two spaces together, which makes the board simpler to use and of course is needed to allow writing to the memory during code download. So in the end, there is really only a 64k address space to use.
A common approach to using more memory is to connect the memory as shown above, and then to connect the higher address bits (A16, A17, etc) to port pins. This is called "bank swapping", because it effectively provides multiple banks of memory and only one is "visible" to the processor at any one time. The banks are "swapped" by changing the port pins that connect to the upper address bits.
In the schematic above, the 39F512 flash rom is actually 64k of memory, but only 30k is available to the user (the chip select logic does not assert CE, pin 22, so that the LCD, 82C55 and chip select signals can use the upper 2k of the memory map). A simple approach to using 60k of flash memory would be to disconnect A15 (pin 3) from +5V and attach it to one of the port pins. Likewise, a 39F040 chip could be substituted for the 39F512, and then A16, A17, and A18 could be attached to additional port pins to provide sixteen banks of 30k or a total of 480k of flash memory.
A similar approach could be used with the RAM chip, as there are 128k and 512k RAM chips. These larger RAM chips have 32 pins instead of 28 pins, but their 28 common pins have similar functions, so only a few extra pins need to be connected. Again, connecting upper address bits to the port pins would allow the memory to be "bank swapped".
Bank swapped memory is most suitable for storing data, such as a data logging application where sensors are read and their data is collected and stored into the flash rom, and later read out when the user collects it to their PC. The MP3 player uses megabytes of RAM to hold MP3 bitstreams that have been read from the hard drive and are waiting to be played by the decoder chip.
Bank swapped memory is not suitable for normal program variables. When the SDCC C compiler allocates a variable in the RAM chip (xdata keyword, which is the default type if you use the large memory model option), the compiler does not "know" about bank swapping. If you change that port pin and the compiler attempts to access any variable in the RAM chip, it will access incorrect information. It is possible to write an application entirely in assembly that makes only proper accesses to bank swapped variables, but it is difficult to write this sort of code. A similar problem occurs when the flash rom is used for both executable code and data logging. The data logging portion can be bank swapped, but the code portion must not change because any change while code is executing would cause the program to crash. There are some creative approaches to write code to deal with these issues, but usually the best approach is to avoid bank swapping for program code and especially for normal program variables.
Often a more sophisticated approach to bank swapping is needed, where a portion of the address space is always the same, and the rest is bank swapped. For example, a 74HC08 AND gate chip could be used between those port pins and the upper address bits (A15, A16, A17, A18) of a 39F040 chip. In this case, the A14 pin could connect to all four AND gates. This could cause all memory access from 0x8000 to 0xBFFF to access the same 16k of flash memory (which could be used for non-volatile program storage), and accesses from 0xC000 to 0xF7FF could access one of sixteen banks of 14k. With even more sophisticated logic, that bank swapped region could access 32 banks and not waste 1/2 of the flash rom chip. The mp3 player project includes a very sophisticated bank switching system that allows 8192 banks of 4k, where the 8051 can "see" any 15 of these at one time by writing to sixteen 2-byte configuration registers.
Whatever approach is taken, bank swapping must be carefully designed for the application so that it does not make the code extreemly difficult to write. Generally, bank swapping should be avoided for normal variables in RAM. It works best for storing collected data.