Make Auto Counter use Multiplexing seven segment display and PIC Microcontroller
In this tutorial we will learn how to make Auto counter use multiplexing seven segment display. Here I am use PIC16F877A microcontroller and 3 digit multiplexing seven segment display.
You can watch the following video or read the written tutorial bellow.
7 segment display
seven segment display has 7 segment and each segment emit light. When segment a,b,c,d,e & f emit light than the display show the decimal value 0.
3 digit 7 segment display
Circuit Diagram
7 segment display
seven segment display has 7 segment and each segment emit light. When segment a,b,c,d,e & f emit light than the display show the decimal value 0.
3 digit 7 segment display
![]() |
0.56'' - digit size |
Circuit Diagram
Mikro C Code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Common Cathod Multiplexing 7 segment display | |
char display[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; | |
int i; | |
char digit1,digit2,digit3; | |
void main(){ | |
TRISB = 0X00; | |
TRISD = 0X00; | |
PORTB = 0X00; | |
PORTD = 0X00; | |
while(1){ | |
for(i=0;i<1000;i++){ | |
digit1 = i/100; | |
digit2 = (i/10)%10; | |
digit3 = i%10; | |
PORTB = display[digit1]; | |
PORTD = 0X01; | |
delay_ms(5); | |
PORTD = 0X00; | |
PORTB = display[digit2]; | |
PORTD = 0X02; | |
delay_ms(5); | |
PORTD = 0X00; | |
PORTB = display[digit3]; | |
PORTD = 0X04; | |
delay_ms(5); | |
PORTD = 0X00; | |
delay_ms(250); | |
} | |
} | |
} |
No comments