Atmega16 C program to toggle all bits of PORT C continuously.
We will set the initial value of PORTC to 10101010 --> AAH .
#include<avr/io.h>
int main(void)
{
DDRC = 0*FF;
PORTC = 0*AA;
for(;;)
{
PORTC = ~PORTC;
// ~ is used as not operator which will not the values present in PORTC
// like 10101010 will be converted to 01010101
}
return 0;
}
#include<avr/io.h>
int main(void)
{
DDRC = 0*FF;
PORTC = 0*AA;
for(;;)
{
PORTC = ~PORTC;
// ~ is used as not operator which will not the values present in PORTC
// like 10101010 will be converted to 01010101
}
return 0;
}
Comments
Post a Comment