Log in

View Full Version : User Processor Execution Time


Andrew Blair
12-02-2006, 21:18
How long does it take a single loop to execute when called in user_routines.c?

Basically, in Process_Data_From_Master_uP, I am calling a function that multiplies my interrupts by 38, to get interrupts a second, and eventually, revolutions per second. If I call this important function in Process_Data_From_Master_uP, will it execute at a consistent 38 Hz? Or do I need to put it in User_routines_fast.c? And How would I do that? Thanks much.


unsigned int Get_Wheel_Speed(void)
{
return((Get_Interrupt1()*38));
}

Alan Anderson
12-02-2006, 21:52
The frequency is consistent, but only on average. You can't count on it being exactly 26.2 milliseconds between calls. And if there's a communication glitch, one or more calls might be skipped entirely.

For what you're doing, you probably should use a timer interrupt.