/* * avr_test.c -- a minimalistic test program for the avr toolchain * * (c) 2005, jw@suse.de * distributable under GPL * * Example usage: * * rpm -i avr-libc.rpm cross-avr-gcc.rpm cross-avr-binutils.rpm uisp.rpm * export PATH=/opt/cross/bin:$PATH * avr-gcc -mmcu=attiny2313 avr_test.c -o avr_test.out * avr-objcopy -O ihex avr_test.out avr_test.hex * uisp -v -dprog=stk200 --erase --upload --verify if=avr_test.hex * * Then connect LEDs to the pins of port A and watch them blink. * * STK200 * ------ * 1 MOSI * 2 VCC * 3 - * 4 GND * 5 RESET * 6 GND * 7 SCK * 8 GND * 9 MISO * 10 GND * * * Top View: * +------------------------------------------------------+ * | +STK200-------+ | * | |2 4 6 8 10| | * | |1 3 5 7 9| | * | +-----___-----+ | * */ #include #define DELAY 1000 int main() { int i, j; DDRB = 0xff; // switch all bits of port A as output. for (;;) { for (i = 0; i <= 0xff; i++) { for (j = 0; j < DELAY; j++) PORTB = i; } } }