
Due to the persistence of vision our eye can’t distinguish what happen in TV. A full movie consists of numbers of pictures that move so fast that we can’t separate them. We will now make a program in which two 7 segment display on-off too fast that we will see a running digit.
In the picture if µC pin is zero 7 segment display will active otherwise inactive.
Let run a simple program and see what happen in proteus.
#include<avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRD=0xff; //7 segment display PORT
DDRB=0x03; //7 seg control pin PD[0,1]
while(1)
{
PORTB=(1<<0); //7 segment corresponding to mcu pin--PINB0 active
PORTD=0b01100000; //display 1
_delay_ms(5); //5ms delay
PORTB=0x03; //Dark condition
_delay_ms(20); //20ms delay
PORTB=(1<<1); //7 segment corresponding to mcu pin--PIND1 active
PORTD=0b11011010; //display 2
_delay_ms(5); //5ms delay
PORTB=0x03; //Dark condition
_delay_ms(20); //20ms delay
}
return 0;
}

In this program first display 1 after that dark condition arise than display 2 in another 7 segment after that dark condition arise and the process repeat. The delays are so adjust so that our eye can’t distinguish and we see a running 7 segment. This trick is so simple and we use it in our next part that counting visitors.







Visit Today : 51
Total Visit : 28466