Friday, June 7, 2013

Microrocontroller & Seven Segments- Counter 00 to 99 - Method2

In this tutorial, we will make a counter from 00 to 99 and the two seven segments will be connected to one port not two different ports as shown in Method1



Code:
void main() {
      unsigned char tensCounter , onesCounter ;
      unsigned int i ;
      TRISB = 0 ; PORTB = 0 ;
     
      while(1)
      {        
           for(i = 0 ; i <= 99 ; i++)
           {
                 PORTB = (i % 10) + (i / 10) * 16 ;
                 Delay_ms(500) ;
           }
      }
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...