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.

[SOLVED] String in Mikroc for pic

Status
Not open for further replies.

majeed1352

Newbie level 3
Joined
Oct 18, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
22
Hi,

I want to get a string from UART1 and analyse it with switch...case as follow:

char Comm[12];
.
.
if(Uart1_data_Readey()){
Uart1_read_text(Comm,".",255);
.
.
switch(Comm){
case "ON": .. .. .. ..; break;
case "OFF":.. .. .. ..; break;
.
.
default: Lcd_out_cp("BAD COMMAND";}


but the cumpiler says: " Operator " is not applicable to these operands"
What should I do to resolve it. Please guide me.

Thanks
 


Code C - [expand]
1
switch(Comm)

is causing the problem because you are testing for a string in switch which the C Compiler doesn't allow. Use strstr() or strcmp() to compare the received strings with strings stored in ROM. Search for CopyConst2Ram() function in mikroe forum and also use it with strstr() and strcmp().
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top