GENERAL

INTERFACING A SEVEN SEGMENT DISPLAY.

INTERFACING A SEVEN SEGMENT DISPLAY.
A seven segment display is an electronic component that is used to put into cognisance, the numerical values that is being performed in a system according to the instruction given to the MCU.
It is a structural arrangement of LEDs that virtually form the shape of the numerical values i.e. [0-9]. This can be done by putting “ON” “OFF” an LED or a set of LEDs from the structural arrangement.
Depending on this structural arrangement, a seven segment display can be a common cathode or a common anode. If it is a “CC” it is set on with 0 while the “CA” is set on with 1.
Here, we want to make use of “CC” to display [0-9] in a single program. Our seven segment is attached to portB on the MCU.
List of Components:
1. MCU.
2. SEVEN SEGMENT DISPLAY.
3. 10k RESISTOR.
4. CRYSTAL OSCILLATOR.
5. CAPACITOR.
Schematic:

Program:
void main() {
char i=0;
char display[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
trisb=0x00;
portb=0x00;
while(1)
{
for(i=0; i<=9; i++)
{
portb=display[i];
delay_ms(1000);
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *