00-24 timer

Thread Starter

Renren

Joined Jun 21, 2011
2
i am asked to create a timer from 0 - 2 using pic16f84a and two 7 seg bcd..
the codes in micro c are as follow

Rich (BB code):
void main(){
     char x;
     char y;
     PORTA=0;
     PORTB=0;
     TRISA=0;
     TRISB=0;
     for (;;){
         for (y=0;y<3;y++){
         PORTA=y;
         for (x=0;x<10;x++){
         PORTB=x;
         delay_ms(200);
         if (y==2&&x==4){
         PORTA=0;
         PORTB=0;
         for (x=0;x<10;x++){
         }
         }
         }
         }
         }
         }
now, im looking for a simpler code than above...
any help!!!
thank you!!
 

Attachments

Last edited by a moderator:
Top