Advertisement
NB52053

Untitled

Jun 26th, 2019
1,406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <mega32.h>
  2. #include<delay.h>
  3.  
  4. void main(void)
  5. {
  6.     int i=0;
  7.     char input [5]= {0b00000000,0b00000001,0b00000010,0b00000011,0b00000100};
  8.    
  9. DDRA = 0b11111111;
  10. DDRB = 0b00000000;
  11. while (1)
  12. {
  13.          if (PINB.5 == 0)
  14.         {if(i==5){
  15.                 i=0;
  16.             }
  17.         PORTA = input[i]   ; // pin 3 of Port C voltage is High            
  18.         i=i+1;
  19.         delay_ms(70);  
  20.   }    
  21.  
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement