7-Segment & Keypad

Not rated 9,917

7-Segment & Keypad
7-Segment & Keypad

Since the output buffer of P1 can sink 20mA (each output pin, but maximum IOL for all outputs was limited at 80mA), thus we can use P1 to drive LED display directly. As shown in the circuit, Two common-anode 7-segment LEDs are connected to P1 with 180 Ohms current limiting resistor. Each segment of two LED are tied in parallel to P1. Q1 and Q2 are activated by logic low of P3.0 and P3.1, sourcing +5V to common anode pins. P3.4 read logic low if either S1 or S2 was pressed while scanning period have made.

The circuit utilizes a microcontroller output port (P1) to directly drive two common-anode 7-segment LED displays. Each output pin from P1 can sink a maximum current of 20mA, allowing for direct control of the segments of the display while ensuring that the total output current does not exceed the specified limit of 80mA for all outputs combined.

In the configuration, a 180 Ohm current limiting resistor is placed in series with each segment of the LED displays to prevent excessive current from damaging the LEDs. The segments of the two 7-segment displays are connected in parallel to the output pins of P1, enabling simultaneous illumination of corresponding segments across both displays.

Transistors Q1 and Q2 serve as switches that are controlled by the logic levels on pins P3.0 and P3.1. When these pins are driven low, Q1 and Q2 are activated, allowing +5V to be sourced to the common anode pins of the LED displays. This configuration ensures that the segments can be illuminated by providing the necessary voltage to the anodes while controlling the cathodes through the P1 pins.

Additionally, pin P3.4 functions as an input that detects a logic low state when either switch S1 or S2 is pressed. This allows the system to perform a scanning operation to determine which switch is activated during the scanning period. The integration of these components facilitates the creation of an effective LED display driver circuit that can provide visual feedback based on user input.Since the output buffer of P1 can sink 20mA (each output pin, but maximum IOL for all outputs was limited at 80mA), thus we can use P1 to drive LED display directly. As shown in the circuit, Two common-anode 7-segment LEDs are connected to P1 with 180 Ohms current limiting resistor.

Each segment of two LED are tied in parallel to P1. Q1 and Q2 are activated by logic low of P3.0 and P3.1, sourcing +5V to common anode pins. P3.4 read logic low if either S1 or S2 was pressed while scanning period have made. 🔗 External reference