View previous topic :: View next topic |
Author |
Message |
mierdogan
Joined: 22 Mar 2011 Posts: 7
|
Error 28 line 15(11,12) Expecting an identifier |
Posted: Wed Mar 23, 2011 3:17 am |
|
|
Hi All,
Can somebody help me for this?
I need all of your help about little code below;
Code: | #include <16F877A.h>
#use delay(CLOCK=4000000)
#fuses XT,NOPUT,NOPROTECT,NOBROWNOUT,NOLVP,NOWDT
#use fast_io(a)
#use fast_io(b)
void main ()
{
if(input(pin_d1))
{
while(!input(pin_d2)) & (!input(pin_d3))
{
output_high(pin_b0);
delay_ms(100);
output_low(pin_b0);
delay_ms(100);
}
}
if(input(pin_d2))
{
while(!input(pin_d1)) & (!input(pin_d3))
{
output_high(pin_b1);
delay_ms(100);
output_low(pin_b1);
delay_ms(100);
}
}
if(input(pin_d3))
{
while(!input(pin_d1)) & (!input(pin_d2))
{
output_high(pin_b2);
delay_ms(100);
output_low(pin_b2);
delay_ms(100);
}
}
output_b(0x00);
while(true);
} |
Error:
Error 28 line 15(11,12) Expecting an identifier
Occurs After:
void main ()
{
if(input(pin_d1))
{
while(!input(pin_d2)) & (!input(pin_d3))
I can find no guidance on how to clear the error.
Thank you
Regards
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Mar 23, 2011 5:44 am |
|
|
Basically a C syntax error, missing parenthesis. Also a logical and rather than bitwise and should be used:
Code: | while(!input(pin_d2) && !input(pin_d3)) |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Wed Mar 23, 2011 5:48 am |
|
|
Looks as though
main has open and closing bracketsunless I've miscounted, again..!
while(1) doesn't.
------------------------------------
main() ..start of main loop
{
...
{ ..start of while loop
...
...
}
while(true); end of while loop
} //end of main loop |
|
|
|