Chapter 7: Microcontroller Interrupts and Timers
sendString("Error - Parse_set received a
non integer: ");
);256dSt oo large\r");set_speed(atoi(set));oid set_speed(int count)ed[11];em oscillator to 2 mHz. We set the
Timer0 prescaler to clk/8 which gives a 250 kHz input to the
re of 250 throws an interrupt every
SK0 = (1<<OCIE0A);sendChar(s[i]
sendChar('\r');
return 0;
}
}
set[j] = '\0';
if(j>4)// must be <
{
sen ring("Error - Parse_set number t
return 0;
}
else
{
}
return 1;
}
v
{
char spe
sendString("Setting the Compare Timer Count to: ");
itoa(count,speed,10);
sendString(speed);
sendChar('\r');
milliSecInit(count);
}
/*
The USART init set the syst
timer/counter. A compa
millisecond.
*/
void milliSecInit(unsigned char count)
{
// Enable timer0 compare interrupt
TIM