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 8<br />

(1) Write the number you want to display to data inputs B0-B3, and bring a digit-select input<br />

(D1-D4) high to select the digit to write to. You can use the same XBY statement to do both.<br />

For example, to write 7 to digit 2, use this statement: XBY(port address)=27H.<br />

(2) With the data still on B0-B3, bring the digit-select input low. <strong>The</strong> data must remain on<br />

B0-B3 for at least 200 nanoseconds after the digit-select input goes low. For step 1’s example,<br />

you would write XBY(port address)=07H.<br />

Follow the same procedure for each digit, and the TC7211 will continue to drive the<br />

appropriate segments on all four digits. To change the value of a digit, repeat steps 1 and 2.<br />

Displaying Messages<br />

Sometimes a device has to display more complex messages than simple LEDs and 7-segment<br />

displays can handle. For example, you might want to display messages like these:<br />

Please enter your access code.<br />

Select function:<br />

Read<br />

Program<br />

Verify<br />

Exit<br />

Wind is from the west at 12 mph<br />

Total cost = $5.82<br />

With BASIC-52, you can use the host computer’s display, but this is no help if you want to<br />

create a stand-alone project that doesn’t require a personal computer. In these situations, a<br />

character-based dot-matrix LCD module is a solution.<br />

<strong>The</strong>se modules can display messages made up of numbers, characters of the alphabet, and<br />

other symbols (for math functions, for example, or even symbols you design yourself).<br />

Figure 8-8 illustrates. Devices that use this type of display include laser printers and test<br />

equipment.<br />

<strong>The</strong> Controller Chip<br />

A special controller chip makes it easier to use LCD modules than you might think. Hitachi’s<br />

HD44780 LCD controller is an 80-lead surface-mount chip that takes care of the details of<br />

controlling the individual dots, or segments, on the display. For as low as $10, you can find<br />

complete modules that contain an LCD panel and small circuit board containing the<br />

138 <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!