Advertisement
dzieciol

Mikrokontrolery 2

Oct 13th, 2017
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include<avr/io.h>
  2.  
  3.    
  4.     int main(void){
  5.     DDRA = 0xff;
  6.     for(;;){
  7.         PORTA = _BV(3) | _BV(4);
  8.         for(int i = 3;i >=0;i--){
  9.             PORTA |= _BV(i) | _BV(7-i);        
  10.             for(unsigned long i=0; i<=16000;i++){
  11.                 __asm__ ( "nop;");
  12.             }
  13.         };
  14.         for(int i=0;i<3;i++){
  15.             PORTA &= ~(_BV(i) | _BV(7-i));         
  16.             for(unsigned long i=0; i<=16000;i++){
  17.                 __asm__ ( "nop;");
  18.             }
  19.            
  20.         };
  21.        
  22.     }
  23. return 0;  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement