18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6<br />

1023 (3FEh) addresses. Indeed, if using every byte of memory is critical, you can use other<br />

methods in place of U11 to more completely decode, or divide, the memory space.<br />

Programmable logic is one possibility, for those who have access to a logic compiler and<br />

device programmer. But for many circuits, complete decoding of memory isn’t necessary,<br />

and less-than-complete decoding using off-the-shelf parts is more practical.<br />

An Output Port<br />

To complement U12’s input byte, U14 provides eight bits of output. U14 is a 74LS374 octal<br />

flip-flop, which is very similar to the 74HCT373 octal latch at U4. On the ’373, 1Q-8Q follow<br />

1D-8D until pin 11 goes high, after which 1D-8D no longer change. In contrast, on the ’374,<br />

1Q-8Q change only on pin 11’s rising edge, when 1D-8D are latched to 1Q-8Q.<br />

Here again, I chose LSTTL over CMOS, this time because the LSTTL device can sink 12ma<br />

at 0.25V, compared to 6ma at 0.2V for the 74HC374. However, the 74HC374 can also source<br />

6ma at 4.2V, so it’s a better choice if you need to draw current from a logic-high output.<br />

U14’s eight data inputs connect to the data bus (D0-D7). Its output control (pin 1) is tied low<br />

so that the outputs are always enabled. If you want to be able to disable the outputs, you can<br />

instead tie pin 1 to an unused bit on Port 1.<br />

NOR gate U13A clocks U14 only when U2 writes to addresses from E400h to E7FFh. When<br />

this occurs, the data written is latched to the outputs of U14. <strong>The</strong> outputs do not change until<br />

the next time the chip is written to.<br />

In the circuit, U14 is write-only. Reading address E400h will return the value 0FFh. To<br />

access U14 at a different address, wire pin 2 of U13A to a different output of U11.<br />

Since U12 is read-only and U14 is write-only, you could use the same address for both, by<br />

having them share the same output of U11. For example, if you wire both pin 2 of U13A<br />

and pin 4 of U9B to pin 7 of U11, both will be accessed at FC00h. Write operations will<br />

access U12, and reads will access U14. In this way, you can add up to eight input ports and<br />

eight output ports, with eight chip-select addresses in all.<br />

Wiring Tips<br />

Add Figure 6-2’s circuits to Chapter 3’s circuits, including the connections shown to D0-D7,<br />

A10-A12, E000h, READ, and WRITE in the main circuit. <strong>The</strong> schematic continues the component<br />

numbering sequence from the earlier schematics. Use sockets for the ICs. Wire U13’s unused<br />

inputs (pins 5, 6, 8, 9, 11, and 12) to GND or +5V. Also add a couple of 0.1-microfarad ceramic<br />

decoupling capacitors from +5V to GND, near the added ICs.<br />

92 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!