- #include <mega32.h>
- #include <delay.h>
- char a,b,c,d;
- void main(void)
- {
- int t1 = 0;
- DDRA = 0xFF ;
- DDRB = 0xFF ;
- DDRC = 0xFF ;
- DDRD = 0xFF ;
- while (1)
- {
- if((t1 % 63) == 0 ){/////////////////PORTA shift
- PORTA = a;
- a <<= 1;
- if(a==0)
- a = 0b00000001;
- }
- if((t1 % 171) == 0 ){/////////////////PORTB shift
- PORTB = b;
- b <<= 1;
- if(b==0)
- b = 0b00000001;
- }
- if((t1 % 342) == 0 ){/////////////////PORTC shift
- PORTC = c;
- c <<= 1;
- if(c==0)
- c = 0b00000001;
- }
- if((t1 % 511) == 0 ){/////////////////PORTD shift
- PORTD = d;
- d <<= 1;
- if(d==0)
- d = 0b00000001;
- t1 = 0;
- }
- delay_ms(1);
- t1++;
- } }
Recent Pastes