Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

switch case with uart

Status
Not open for further replies.

RAJPUT VIDISHA

Member level 1
Joined
Jul 14, 2015
Messages
37
Helped
0
Reputation
0
Reaction score
1
Trophy points
6
Activity points
344
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");

}
}

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top