21.08.2013 Views

Embedded Systems Design with the Atmel AVR Microcontroller Part II

Embedded Systems Design with the Atmel AVR Microcontroller Part II

Embedded Systems Design with the Atmel AVR Microcontroller Part II

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.3. MOTOR SPEED CONTROL 251<br />

{<br />

input_delay++; //input delay processing<br />

}<br />

//*************************************************************************<br />

//delay(unsigned int num_of_6_55ms_interrupts): This generic delay function<br />

//provides <strong>the</strong> specified delay as <strong>the</strong> number of 6.55 ms "clock ticks" from<br />

//<strong>the</strong> Timer0 interrupt.<br />

//Note: This function is only valid when using a 10 MHz crystal or ceramic<br />

// resonator<br />

//*************************************************************************<br />

void delay(unsigned int number_of_6_55ms_interrupts)<br />

{<br />

TCNT0 = 0x00; //reset timer0<br />

input_delay = 0;<br />

while(input_delay

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!