[Icc-avr] Software Delay
Andrew
andrew_166 at msn.com
Tue Jan 8 08:18:10 PST 2008
Hi,
I need a good software time delay that sit's in an interrupt handler. Basically i need it to de-bounce a pin (INT1). and i cannot use a timer as the timer interrupts are disabled at this point in the code.
I was thinking of using : -
#pragma interrupt_handler int1_isr:iv_INT1
void int1_isr(void)
{
delay_2();
}
//-----------------------------------------------------------------------------
//
// Function name : Delay_2
//
// Returns : None
//
// Parameters : None
//
// Purpose : De-Bouce delay
//
//-----------------------------------------------------------------------------
void delay_2 (void)
{
for (loop_int = 0; loop_int < 100; loop_int++)
{
NOP();
}
loop_int = 0x00;
}
Only probem is that i have no clue how long this delay is? ( i am running the main clock at 8Mhz)
Does anydy have a better software delay function.
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080108/55de1276/attachment.html
More information about the Icc-avr
mailing list