SHARE
TWEET

LED COUNTER

NB52053 Jul 3rd, 2019 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // LED COUNTER
  2.  
  3.  
  4.  
  5.  
  6. #include <mega32.h>
  7. #include <delay.h>
  8. void main(void)
  9. {
  10. int i=0;
  11. char arr[]={0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101};
  12. DDRA=0xFF;
  13. DDRB=0xFF;
  14.  
  15. while (1)
  16. {
  17.  
  18. PORTA=0b11111110; // 4th selector is on
  19. //PORTB=0b00111111;
  20. //delay_ms(100);
  21.  
  22.    if(i<6)
  23.       {
  24.         PORTB = arr[i];
  25.         delay_ms(250);
  26.         i++;
  27.       }
  28.    else
  29.       {
  30.           i=0;
  31.       }
  32.    
  33.        
  34. }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top