Download The Microcontroller Idea Book: Circuits, Programs & Applications
Transcript
Chapter 8 Listing 10 20 30 40 50 60 70 80 90 8-2. Causes a 7-segment LED to display each digit in sequence. REM configure all ports as outputs XBY(0FC03H)=80H REM write each value to the display in sequence FOR I=0 TO 9 XBY (0FC00H)=I REM delay after each write FOR J=1 TO 500:NEXT J NEXT I END may be two common-anode pins.) To find the pin that controls each segment, leave the +5V lead on a common-anode pin, and connect the resistor to each pin in turn, noting the results. For a common-cathode display, to find the common-cathode pin or pins, connect a pin to +5V, and touch the others to ground through the 330-ohm resistor. The pin or pins that cause the segment to light are the common-cathode connections. To find the pin that controls each segment, move the +5V lead to each pin in turn, and note the results. Interfacing For 7-segment decoder/drivers, you can choose from single-digit and multi-digit chips. Single-digit driver. Figure 8-4 shows a 7-segment display controlled by a 4511B latch/decoder/driver. The display shows the value of the 4-bit number at the 4511’s data inputs A-D. The 4511 will drive common-cathode displays directly. Common-anode displays require inverters at the segment outputs. You can use any output port bits to control the display. An 8-bit port will control a 2-digit display. Listing 8-2 tests Figure 8-4’s circuits by displaying each digit in sequence. The program assumes that a display connects to bits 0-3 of Port A on an 8255 addressed at FC00h. If your system has different addressing, change the program to match. Multi-digit driver. If you want to display more than a couple of digits, there are specialized chips that will drive and control multiple-digit displays. One example from Intersil (now part of Harris Semiconductor) is the ICM7218D multiplexed display driver, which can control up to 8 common-cathode digits. Figure 8-5 illustrates. For common-anode displays, use the ICM7218C. The segments of all eight displays connect to the 7218D’s segment-driver outputs (a-g, dp). Each display’s common cathode connects to one of eight DIGIT outputs. An internal oscillator 132 The Microcontroller Idea Book