RAJPUT VIDISHA
Member level 1
Hello...i'm using switch case with uart and dont know y it's not working...so plz can anyone tell me wer im going wrong...
unsigned char low, upp ,KP ;
void main() {
CMCON |= 7;
ADCON1 = 0x0F; // Configure all ports with analog function as digital
UART1_Init(9600); // Initialize UART module at 9600 bps
delay_ms(1000);
UART1_Write_Text("Hello");
if(UART1_Data_Ready()==1){
KP = UART1_Read();
switch (KP) {
case 'a': UART1_Write("this is function 1"); break;
case 'c': UART1_Write("this is function 2"); break;
default : UART1_Write("INVALID");
}
}
}
unsigned char low, upp ,KP ;
void main() {
CMCON |= 7;
ADCON1 = 0x0F; // Configure all ports with analog function as digital
UART1_Init(9600); // Initialize UART module at 9600 bps
delay_ms(1000);
UART1_Write_Text("Hello");
if(UART1_Data_Ready()==1){
KP = UART1_Read();
switch (KP) {
case 'a': UART1_Write("this is function 1"); break;
case 'c': UART1_Write("this is function 2"); break;
default : UART1_Write("INVALID");
}
}
}