PROJECT 11
7 SEGMENT DISPLAY WITH DIRECT I/O
Back to Project 10 | Go to Project 12 |
Nowadays, 7 segment has become the most popular display unit on market because it is cheap, easy to program and small. On market, we can found that there was 2 types of 7 segment which is common anode and common cathode. In this project, we are going to use 7 segment with common cathode and directly interface to microcontroller.
———————————————————————————————————————————————————-
COMPONENT NEEDED
———————————————————————————————————————————————————-
![]() |
7 SEGMENT DISPLAY x2 |
![]() |
BREADBOARD |
![]() |
1K RESISTOR x2 |
![]() |
JUMPER WIRES |
———————————————————————————————————————————————————-
CONNECTION
———————————————————————————————————————————————————-
From figure below, we can see that the 1st 7 segment are connected to PORTC.0 to PORTC.6, while 2nd 7 segment are connected to PORTD.0 to PORTD.6. Both of the 1K resistor are connected to ground(GND).
———————————————————————————————————————————————————-
ADDITIONAL INFORMATION
———————————————————————————————————————————————————-
7 segment have separated to 2 types which is common cathode and common anode which show in figure below.
COMMON CATHODE
Common cathode means that all the ground (GND) are all connected together. To ON the LED inside, we have to give a signal HIGH(1) or +5V to the input port of 7 segment.
COMMON ANODE
Common anode means that all the voltage in (VCC) are connected together. To turn ON the LED inside, a signal LOW(0) or 0V are required to the 7 segment input port.
1K RESISTOR
By refering to the circuit. We have connected 1K resistor to each 7 segment to limit the current flowing through it so that it may prevent the 7 segment from spoil.
7 SEGMENT INPUT TO PIC MCU
———————————————————————————————————————————————————-
CODE OVERVIEW
———————————————————————————————————————————————————-
MAIN PROGRAM
unsigned int dis1[]
For this part, we use ARRAY to continuously display the 7 segment character from 0 to 9 and also from 9 to 0.
SEG1_dis = dis1[num];
7 segment 1 will continuously display the number from dis1[] once the num are increase 1 at the time.
#define dis_1 0b00000110
In system.h, we have already declare the output display of 7 segment.
#define SEG1_dis PORTC
In here, we have selected the output port that the data will be send through.
Back to Project 10 | Go to Project 12 |
———————————————————————————————————————————————————-
ATTACHMENT
BUY
2 thoughts on “Project 11 – 7 segment display with I/O”
Have you include the system.h file in the same folder of the project?
hi, i cant compile the code given for this project.
its says “Error [141] C:\Users\User\Documents\SK40\Project_11.c; 11.19 can’t open include file “system.h”: No such file or directory”.
what should i do?