/************************************************************* * at85-0.c - Demonstrate simple I/O functions of ATtiny85 * * Program loops turning PB4 on and off as fast as possible. * * The program should generate code in the loop consisting of * LOOP: SBI PORTB,4 (2 cycles) * CBI PORTB,4 (2 cycles) * RJMP LOOP (2 cycles) * * PB4 will be low for 4 / clock freq * PB4 will be high for 2 / clock freq * An internal 8MHz clock with CLKDIV8 enabled gives a loop period * of about 6 microseconds. * * Revision History * Date Author Description * 11/02/12 A. Weber Initial Release *************************************************************/ #include int main(void) { DDRB |= 1 << DDB4; // Set PORTB bit 4 for output while (1) { PORTB |= 1 << PB4; // Set PB4 to a 1 PORTB &= ~(1 << PB4); // Set PB4 to a 0 } return 0; /* never reached */ }