Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
/****************INITIALIZATIONS*******************/ //other stuff Im experimenting with for SoR //uartInit(); // initialize the UART (serial port) //uartSetBaudRate(9600);// set the baud rate of the UART for our debug/reporting output //rprintfInit(uartSendByte);// initialize rprintf system timerInit(); // initialize the timer system configure_ports(); // configure which ports are analog, digital, etc. a2dInit(); // initialize analog to digital converter (ADC) a2dSetPrescaler(ADC_PRESCALE_DIV32); // configure ADC scaling a2dSetReference(ADC_REFERENCE_AVCC); // configure ADC reference voltage //rprintf("Initialization Complete\r\n"); /**************************************************/ /*********ADD YOUR CODE BELOW THIS LINE **********/ LED_on();//turn LED on Beep_off(); timer0Init(); while(1) { timecycles=timer0GetOverflowCount(); if(timecycles>= 1) { Beep_on(); } else { delay_cycles(200); } } return 0; }
#include <delay.h>
delay_ms(10000);
void configure_ports(void) { DDRC = 0x00; //configure all C ports for input PORTC = 0x00; //make sure pull-up resistors are turned off DDRD = 0xFF; //configure all D ports for output DDRB = 0xC7; //configure B ports 0, 1, 2, 6, 7 for output (google search '0b11000111 to hex') }
#define F_CPU 8000000UL /* 8MHz crystal oscillator */ #define BUTTON_PORT PORTD /* PORTx - register for button output */#define BUTTON_PIN PIND /* PINx - register for button input */#define BUTTON_BIT PD2 /* bit for button input/output */