Part Number: MSP430G2553
Tool/software: TI C/C++ Compiler
Hi,
i wrote a program that get adc avg
the adc is read by the timer and i set a flag that alert me that data can be retrieve (f_wt_ready)
I have the follwoing code:
inline void AvgAdcOutput(float* weight, char cycles, char display)
{
char i = cycles;
*weight = 0;
f_wt_ready = 0;
for(i=cycles; i> 0; i--)
{
if(f_wt_ready)
{
*weight += (float)wt_temp;
if(display == 1)
{
NumToString(wt_temp,msg);
msg_location = 0x9A;
f_msg = 1;
}
f_wt_ready = 0;
}
else
i++;
}
*weight /= cycles;
}
before the loop i set f_wt_ready = 0 for new data retrieval.
but the if inside the loop not being true even though the f_wt_ready equal 1
i think it could be something with the complier because when i remove f_wt_ready = 0 before the loop it working well
plus i can't enter a breakpoint inside the loop at run time only outside the loop.
thank you