Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Last active February 4, 2016 11:39
Show Gist options
  • Save SaheblalBagwan/0811ecb9729cf87d44bd to your computer and use it in GitHub Desktop.
Save SaheblalBagwan/0811ecb9729cf87d44bd to your computer and use it in GitHub Desktop.
#include <avr/io.h>
#include <util/delay.h>
int main()
{
char count = 1;
DDRC = 0xff; // Configure PORTC as output
while(1)
{
PORTC = count; // Display Counter value on LEDs
_delay_ms(200); // Wait for some time
count = count<<1; // Left shift the bit to generate ring counter
if(count == 0) // If counter reaches zero then set it back to 1;
count = 0x01;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment