swapan
Full Member level 4
- Joined
- Feb 20, 2009
- Messages
- 204
- Helped
- 27
- Reputation
- 54
- Reaction score
- 24
- Trophy points
- 1,298
- Location
- Kolkata
- Activity points
- 2,839
Friends,
I tried this simple code compiled in mikroC. When built it shows error as "Invalid expression" against a statement. The statement (red coloured) is shown below. Your help is highly solicited.
swapan
I tried this simple code compiled in mikroC. When built it shows error as "Invalid expression" against a statement. The statement (red coloured) is shown below. Your help is highly solicited.
swapan
Code:
int sample();
int sample() {
int l_volt;
l_volt = ADC_Read (4);
return (l_volt);
}
int g_volt;
void main() {
TRISC = 0x07;
TRISA = 0x00;
CMCON = 0x07;
ANSEL = 0x30;
do {
g_volt = sample();
if (g_volt < 622)
PORTA.F5 = 0;
PORTA.F4 = 0;
[COLOR="#FF0000"]else if (g_volt > 622 && g_volt < 800)[/COLOR] // Invalid expression.
PORTA.F5 = 1;
PORTA.F4 = 0;
else if (g_volt > 800 && g_volt < 1000)
PORTA.F5 = 0;
PORTA.F4 = 1;
else
PORTA.F5 = 1;
PORTA.F4 = 1;
} while (1);
}