Forum 2005-2010 (read only)
How fast does arduino process each line of code?
Topic: How fast does arduino process each line of code?
(Read 18054 times)
Scattered showers my arse -- Noah, 2348BC.
Re: How fast does arduino process each line of code?
Jan 20, 2011, 03:43 pm
Not really sure exactly how quickly the avr responds to an interrupt.
Pretty fast, the order of events is something like this
int happens (a pin change int takes 4 clock cycle to be recognised)
wait for end of current instruction
push current program counter onto stack
load int vector into PC
IIRC I've seen it take about 1.5uS to get into the ISR.
Thats at the ASM level, however if using C there could be a stack of extra code to save registors as well.
Just as an aside, it can be faster to poll, if you really need to react fast to say a pin change it will be faster to just constantly read the pin. Of course you don't get anything else done
Rob Gray aka the GRAYnomad