Friday, June 7, 2013

Microrocontroller & Seven Segments- Counter 00 to 99 - Method1

Now,i will show you a simple schematic and a simple code for interfacing micrcontroller with two seven segments through two BCD to seven segment decoders easily.

 Code:

void main() {
       unsigned char tensCounter , onesCounter ;
       TRISB = 0 ; PORTB = 0 ;
       TRISC = 0 ; PORTC = 0 ;
      
       while(1)
       {
             for(tensCounter = 0 ; tensCounter <= 9 ; tensCounter++)
             {
                   PORTB = tensCounter ;
                   for(onesCounter = 0 ; onesCounter <= 9 ; onesCounter++)
                   {
                           PORTC = onesCounter ;
                           Delay_ms(500) ;
                   }
             }
       }
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...