Advanced PIC Microcontroller Projects in C: From USB to RTOS with the PIC18F Series

Project 6.4: Two-Dice Project Using Fewer I/O Pins

Project 6.4: Two-Dice Project Using Fewer I/O Pins

Project Description

This project is similar to Project 3, but here LEDs are shared, which uses fewer input/output pins.

The LEDs in Table 6.1 can be grouped as shown in Table 6.3. Looking at this table we can say that:

  • D4 can appear on its own

  • D2 and D6 are always together

  • D1 and D3 are always together

  • D5 and D7 are always together

Table 6.3: Grouping the LEDs

Required number

LEDs to be turned on

1

D4

2

D2 D6

3

D2 D6 D4

4

D1 D3 D5 D7

5

D1 D3 D5 D7 D4

6

D2 D6 D1 D3 D5 D7

Thus, we can drive D4 on its own and then drive the D2,D6 pair together in series, the D1,D3 pair together in series, and also the D5,D7 pair together in series. (Actually, we could share D1,D3,D5,D7 but this would require 8 volts to drive if the LEDs are connected in series. Connecting them in parallel would call for even more current, and a driver IC would be required.) Altogether, four lines are needed to drive the seven LEDs of each dice. Thus, a pair of dice can easily be driven from an 8-bit output port.

Project Hardware

The circuit diagram of the project is shown in Figure 6.16. PORTC of a PIC18F452 microcontroller is used to drive the LEDs as follows:

  • RC0 drives D2,D6 of the first dice

  • RC1 drives D1,D3 of the first dice

  • RC2 drives D5,D7 of...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Fiber Optic Transmitters
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.