PIC16F877A

MULTIPLEXING.

As the word implies multiplexing, it refers to the sending of multiple signal through a sing flex.
We can multiplex a seven segment display making it to display 2, 3 and 4 digits at the same time. How is trhis possible? It is very possible, we only need a very simple logic to do that.
As we know a seven segment display can either be a CC or CA. If CC it will be pulled up by “0” (GND) and if CA by “1” (VCC).
Instead of combining four single seven segment display which each has 8 pins and a pull up pin making it 9 pins. multipling this by 4 makes it 36 pins. This is way too much.
Here, in this experiment, we will be using CC. The multiplex seven segment we are using has 4 set of single seven segment, having 8 pins and 4 pull up legs, the 4 legs represents pull up legs for each single seven segment which needs GND.
Now, instead of grounding, we will attach the pull up legs to a port on th MCU and suplly it with “0”. Taking into congnisance that we have to keep the 4 legs scanning so as to keep our display steady.
Straight to our experiment we need :
⦁ PIC16F877A.
⦁ MULTIPLEXED SEVEN SEGMENT.
⦁ CRYSTAL OSCILLATOR.
⦁ 22pf CAPACITOR.
⦁ 10K RESISTOR.
Schematic:

Program:
char display[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void sevenseg(char n){
char i;
char ch[3];
char rem=n;
ch[0]=rem%10;
rem/=10;
ch[1]=rem%10;
rem/=10;
ch[2]=rem%10;
rem/=10;
for(i=0;i<100;i++){
portb=display[ch[2]];
portc=0xef;
delay_ms(15);
portc=0xff;
portb=display[ch[1]];
portc=0xdf;
delay_ms(15);
portc=0xff;
portb=display[ch[0]];
portc=0xbf;
delay_ms(15);
portc=0xff;
}
}
void main() {
trisb=0x00;
portb=0x00;
trisc=0x00;
portc=0x00;
while(1){
sevenseg(184);
}
}
Outcome:

Leave a Reply

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