pic_pro2010
Joined: 20 Feb 2010 Posts: 1
|
getch() problem |
Posted: Sat Feb 20, 2010 4:38 am |
|
|
Here is the code I am trying to compile:
Code: |
char menu(void);
void main()
{
while(1)
{
switch (menu()) {
case '1': {
output_bit(PIN_A0,1);
delay_ms(1000);
output_bit(PIN_A0,0);
break;
}
case '2': {
output_bit(PIN_A1,1);
delay_ms(1000);
output_bit(PIN_A1,0);
break;
}
case '3': {
output_bit(PIN_A2,1);
delay_ms(1000);
output_bit(PIN_A2,0);
break;
}
default: {
output_bit(PIN_A0,0);
output_bit(PIN_A1,0);
output_bit(PIN_A2,0);
break;
}
}
}
///////User Selection Menu//////////////////////////////
line 54: char menu(void)
{
char ch;
printf ("\n\r Press A to turn LED on RA0 .......");
printf ("\n\r Press B to turn LED on RA1 .......");
printf ("\n\r Press C to turn LED on RA2 .......");
ch = getc(); //wait for and get serial character
//delay_ms(100);
return ch;
}
/////////////////////////////////////////////////////////
|
And these are the error messages I am getting:
Quote: |
>>> Warning 203 "pic18f4523ledo_p.c" Line 13(1,1): Condition always TRUE
*** Error 51 "pic18f4523ledo_p.c" Line 54(1,5): A numeric expression must appear here
*** Error 127 "pic18f4523ledo_p.c" Line 62(10,16): Return value not allowed in void function
*** Error 79 "pic18f4523ledo_p.c" Line 66(57,58): Expect }
3 Errors, 1 Warnings.
|
I am lost. What am I missing here? |
|