Hey hello everybody,
currently im working with a digital filter assignment, and everything looked real good when I simulated it in avr studio.
the filter routine only needed roughly 35uSec per call.
The whole while loop from reading adc to filter procedure to output port was merely few microseconds extra.
But when I download the code into my atmega32, it has a sample time of 140-ish microseconds. Ive removed the ADC code to elliminate the possibility of having the adc bog me down.
AVR studio reporting wrong cpu cycle counts?
Can anyone verify this? kinda lost here :?
unsigned char RLC_output(unsigned char buffer) { static float rlc_Yk1; static float rlc_Yk2; static float rlc_Xk1; static float rlc_Xk2; float Out; Out = 0.1053*rlc_Xk1 + 0.1016*rlc_Xk2 + 1.692*rlc_Yk1 - 0.8989*rlc_Yk2; rlc_Xk2 = rlc_Xk1; rlc_Xk1 = buffer; rlc_Yk2 = rlc_Yk1; rlc_Yk1 = Out; return (unsigned char)Out; }