#define F_CPU 16000000UL #include #include void pin_setup(void) { DDRC=(1<>4)+'A'); //Send first half uart_write((th&15)+'A'); //Send second half } uart_write((tl>>4)+'A'); //Send lower byte's upper half uart_write((tl&15)+'A'); //Send lower byte's lower half uart_write('\n'); //Frame end symbol } unsigned char isn(unsigned char c) { return('0'<=c && c<='9'); } ISR(USART_RX_vect) { unsigned char rx=UDR0, d=0; static unsigned char b[3]={0,0,0}, i=0; EIMSK=0; if(rx=='\n') { if(i==0) { TCCR2A&=~(1<2) { i=0; } b[i++]=rx; } uart_write(rx); } int main(void) { pin_setup(); //Setup pins and pin interrupts uart_setup(); //Setup uart timer_setup(); //Setup timer sei(); //Enable global interrupts while(1); //Everything is interrupt driven <3 return(0); }