volatile unsigned int x = 0;
volatile unsigned int y = 0;
volatile unsigned int z = 0;
if((PORTB.0 == 1) && (ldr1 <= 300)) [B]// [COLOR="#FF0000"]suppose that when this line is executed PORTB.0 = 1 so the condition is true[/COLOR][/B]
{ [B] // [COLOR="#FF0000"]in this line you may get an interrupt and set PORTB.0 = 0 so now when you return here the following line will execute although it shouldn't and can mess things up[/COLOR] [/B]
if(x > 1)
{
x = x - 1;
}
}
if(pulse_flag >= 3)
volatile unsigned int x = 0; // This never give me any pulse if I start with smaller adc value than the predetermined limit
volatile unsigned int y = 0; // If I start with high adc value (higher than the predetermined limit), everything is OK
volatile unsigned int z = 0;
volatile unsigned int x = 2;
volatile unsigned int y = 2;
volatile unsigned int z = 2;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?