Atmega32 Embedded C - LED Blink in a new Cool Pattern
Atmega32 Embedded C - LED Blink in a new Cool Pattern
/*
* Created: 01/04/2018 00:30:00
* Author : ANANDHU-PC
*/
#include <avr/io.h>
int main(void)
{
DDRB=0xff;
PORTB=0x01;
while(1){
PORTB=PORTB<<1;
if(PORTB==0x80){
PORTB=PORTB<<1;
PORTB=0x80;
while(1){
PORTB=PORTB>>1;
if(PORTB==0x00){
PORTB=0x01;
break;
}
}
}
}
}
/*
* Created: 01/04/2018 00:30:00
* Author : ANANDHU-PC
*/
#include <avr/io.h>
int main(void)
{
DDRB=0xff;
PORTB=0x01;
while(1){
PORTB=PORTB<<1;
if(PORTB==0x80){
PORTB=PORTB<<1;
PORTB=0x80;
while(1){
PORTB=PORTB>>1;
if(PORTB==0x00){
PORTB=0x01;
break;
}
}
}
}
}
Output
0000 0001
0000 0010
...... ..........
1000 0000
0100 0000
0010 0000
................
0000 0001
...... .......
repeats...
Comments
Post a Comment