bobx
Junior Member level 3

Problems with switch instruction in mikroC PRO for PIC?!
Hello,everybody.I wrote a program consist of few functions.And in each functions I used switch instructions and at
each case of the switch instruction I called one function.But it gives me some errors that you can see at the following.
Would you please tell me what is wrong with my program?How can I solve it?Any tricks?
Thanks,
**My program;
Hello,everybody.I wrote a program consist of few functions.And in each functions I used switch instructions and at
each case of the switch instruction I called one function.But it gives me some errors that you can see at the following.
Would you please tell me what is wrong with my program?How can I solve it?Any tricks?
Thanks,
**My program;
Code:
/*
MCU: PIC18F452.
Oscillator: HS, 20.0000 MHZ.
SW: mikroC PRO for PIC.
* NOTES:
*/
unsigned char cursx,cursy;
void E2D1(void){
unsigned char cursx,cursy;
cursx=0;
cursy=7;
LK1:
if((cursy==7)&&(RB5_bit)) goto sbtlen0;
sbtlen0: switch(cursx){
case 5: E2D1();break;
case 7: E1M1();break;
case 11: E4CA1();break;
}
Delay_ms(313);
goto LK1;
}//~
void E1M1(void){
unsigned char cursx,cursy;
cursx=0;
cursy=7;
LK1:
if((cursy==7)&&(RB5_bit)) goto sbtlen0;
sbtlen0: switch(cursx){
case 5: E2D1();break;
case 7: E1M1();break;
case 11: E4CA1();break;
}
Delay_ms(313);
goto LK1;
}//~
void E4CA1(void){
unsigned char cursx,cursy;
cursx=0;
cursy=7;
LK1:
if ((cursy==7)&&(RB5_bit)) goto sbtlen0;
sbtlen0: switch(cursx){
case 5: E2D1();break;
case 7: E1M1();break;
case 11: E4CA1();break;
}
Delay_ms(313);
goto LK1;//EXIT.
}//~
void main() {
PORTA=0;//Clear portA.
TRISA=0XFF;//PortA is input.
PORTD=0;//Clear portD.
TRISD=0;//PortD is output.
PORTC=0;//Clear portC.
TRISC=0;//portC is output.
PORTB=0;//Clear portB.
TRISB=0XFF;//portB is input.
PORTE=0;//Clear portE.
TRISE=0;//PortE is Output. zzzzz.
TRISC = PORTC = 0;
RCON.IPEN =1;//Enable priority levels on interrupts.
INTCON.INT0IE =1;//Enables the INT0 external interrupt.
INTCON2.INTEDG0 =0;//Interrupt on falling edge.
INTCON.RBIE =1;//Enables the RB Port change interrupt.
ADCON1=0;//Configure AVDD=A/DVref+,AVss=A/DVref,16-Analog channels analog I/P.
ADCON2=1;//Right justified A/D Result Format,
//0TAD[A/D acquisition time select bits],
//Fosc/2[A/D conversion clock select bits.].
Delay_ms(400);
E4CA1();
}//~!
***Errors;
0 125 All files Preprocessed in 62 ms
0 121 Compilation Started SwhInstcTST.c
36 324 Undeclared identifier 'E1M1' in expression SwhInstcTST.c
38 324 Undeclared identifier 'E4CA1' in expression SwhInstcTST.c
66 324 Undeclared identifier 'E4CA1' in expression SwhInstcTST.c
135 324 Undeclared identifier 'ADCON2' in expression SwhInstcTST.c
0 102 Finished (with errors): 01 Jun 2011, 18:30:50 SwhInstcTST.mcppi
Last edited: