. .

 | 
 

 digital clock using pic 16f877a

         
eng_especial


avatar

: 535
: 02/08/2007

: digital clock using pic 16f877a    10 - 19:51







unsigned int time,a,b,e,dig1,dig2,dig3,counter1,counter2,counter3,dig4,dig5,dig6;
void interrupt() {
intcon.t0if =0;
time++;
if (time==1000){
time=0;
counter1++;
if( counter1==60){
counter1=0;
counter2++; }
}
if (counter2==60){
counter2=0;
counter3++;}
if (counter3==12)
counter3=0;
}

void main () {
adcon1 =6;
trisc =0;
trise =0;
porte =0;
portc =0;
trisd=0;
portd=0;
counter1 =0;
counter2 =0;
counter3 =0;
tmr0=5;
a=b=e=0;
dig1=0;
dig2=0;
dig3=0;
dig4=0;
dig5=0;
dig6=0;
time=0;
intcon.gie=1;
intcon.t0ie=1;
option_reg.intedg=1;
option_reg.t0cs=0;
option_reg.psa=0;
option_reg.ps2=0;
option_reg.ps1=0;
option_reg.ps0=1;
while (1) {
a = Dec2Bcd16(counter1);
dig1 = a & 15 ;
dig2 = a >> 4;
dig2 = dig2 & 15;
b = Dec2Bcd16(counter2);
dig3 = b & 15;
dig4 = b >> 4;
dig4=dig4 &15;
e = Dec2Bcd16(counter3);
dig5 = e & 15;
dig6 = e >> 4;
dig6=dig6 &15;

portc = dig1;
portd = 0b11111110;
delay_ms (5);

portc = dig2 ;
portd = 0b11111101;
delay_ms (5);

portc = dig3 ;
portd = 0b11111011;
delay_ms (5);

portc = dig4 ;
portd = 0b11110111;
delay_ms (5);
portc = dig5 ;
portd = 0b11101111;
delay_ms (5);
portc = dig6 ;
portd = 0b11011111;
delay_ms (5);

}
}


_________________
- !!
ߡ ߡ ѿ!!
- 㡡 .
- :
С .

url=http://www.gulfup.com/][/url]
    
Esraa Gamal




: 1
: 26
/ :
:
: 24/04/2011

: : digital clock using pic 16f877a    24 - 17:34

mmken l simulation of this code on protus please
    
 
digital clock using pic 16f877a
          
1 1
 
-
»  digital clock project
»  Biological clock
»  DSP /

:
 ::   ::  -