I did this simple program but my if statement doesn't work properly. Here my code:
void SCRIVI_RUOTA(int s, int i, int c)
{
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(C, (segK|segL|segM), 0, (PORT_SRE_SLOW | PORT_DSE_HIGH)); // this switch off all my LEDS
s=0;
i=0;
c=0;
if(s==1)
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(C, (segK), (segK), (PORT_SRE_SLOW | PORT_DSE_HIGH)); // this switch on my LED N° 1
if(i==1)
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(C, (segM), (segM), (PORT_SRE_SLOW | PORT_DSE_HIGH)); // this switch on my LED N° 2
if(c==1)
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(C, (segL), (segL), (PORT_SRE_SLOW | PORT_DSE_HIGH)); // this switch on my LED N° 3
}
well, I can put s, i, c, equals to 0 or 1 but the if statement is always execute and my LEDS turn on in any case.
if I delete the switch on command inside the if statement the LED doesn't turns on (and this means that there are not other functions that make conflicts forcing the LEDs to high). if I put an else after the if statements that switch OFF the LEDs all the LEDs switch OFF. It sounds like if the if and else statement doesn't exist and the last command on the LED is execute. Is it possible exist functions or macros or something else that ignore the if statement?