//*************************************** //*************************************** // // AVRLIB-DEMO // For avrlib and avrmini development board. // // // File: flash.c // Author: Michael Gurevich // Date: Sept. 22, 2002 // Modified: Sept: 22, 2002 // // // Using the avrmini development board, connect // the LED/pushbutton jumper to the Port D jumper. // // //*************************************** // This program will flash the first LED // on the avrmini board. // //*************************************** #include #include #include "global.h" #include "timer.h" int main(void) { // set led pins as outputs, button pins as inputs outb(DDRD, 0x0F); // Turn off LEDs - looking at the circuit // you can see that they are off when pulled high outb(PORTD, 0xFF); // initialize the timer timerInit(); //loop forever while (1) { //clear bit on pin0 - turn LED on cbi(PORTD,PD0); timerPause(500); //set bit on pin0 - turn LED off sbi(PORTD,PD0); timerPause(500); } return 0; }