CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

found error

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

found error
PostPosted: Fri Jan 20, 2012 1:43 pm     Reply with quote

I found error Expecting :.
Code as:
Code:

step_mode = Process_ch();
switch(step_mode)
{
           case (step_a) ;
{
            output_low(RL1);
            output_low(RL2);
            output_low(RL3);
}
             break;

           case step_b ;
{
            output_high(RL3);
            output_low(RL2);
            output_low(RL1);
}
             break;

           case step_2 ;
{
              output_low(RL3);
              output_high(RL1);
              output_low(RL2);
}
             break;

           case step_3 ;
          {
            output_high(RL3);
            output_low(RL2);
            output_high(RL1);
 
          }
            break;
           case step_4 ;
          {
              output_low(RL3);
              output_high(RL1);
              output_high(RL2);
 
           }
            break;

           case step_5 ;
          {
            output_high(RL3);
            output_high(RL2);
            output_high(RL1);

          }
             break;
}

_________________
sahu
temtronic



Joined: 01 Jul 2010
Posts: 9220
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 20, 2012 2:19 pm     Reply with quote

You should press F11 when your project is open to gain access to the CCs onscreen HELP files !!
A couple of keypresses will show you the 'syntax' error you created.
While I can't touchtype I create a few myself with a halfdead finger....


...
case (step_a) ;
*
*

This should not be a semi colon but a colon.

Also you used (...) for a but not for the other cases.

While it might not affect the result it is 'sloppy' or 'inconsistant' in the programming 'style'.
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Fri Jan 20, 2012 2:19 pm     Reply with quote

Hi,

Each case statement should end with a ':' (colon), not a ';' (semi-colon). This is pretty much exactly what the compiler is telling you!

John
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Jan 20, 2012 4:32 pm     Reply with quote

It is often useful when compiling to assume that errors are always caused by the coder. Don't be stubborn or too proud it will cost you time.
In this case the compiler said it was expecting a colon and guess what a colon was missing.I know it is hard for some to believe a machine could be right and they could be wrong but most of us who like winning will bet on the machine. Now the machine isn't perfect so once in a while like winning the lottery the machine loses......but when it loses it is more probable that it compiled without syntax errors and then went on to mess up the machine instructions.
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Sat Jan 21, 2012 2:35 pm     Reply with quote

ezflyr wrote:
Hi,

Each case statement should end with a ':' (colon), not a ';' (semi-colon). This is pretty much exactly what the compiler is telling you!

John

Thank you Mr. John.
My problem solved.
_________________
sahu
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Sun Jan 22, 2012 10:04 am     Reply with quote

Now my problom was solved.
But facing new problom. I use 1 adc & want two different switch case.
1 - switch case for operate 1 relay.
2 - switch case for operrate 3 relay.
OK
I use like this
Code:

void main()
{
   disable_interrupts(GLOBAL);
etc
:
:   enable_interrupts(GLOBAL);   while (TRUE)
   {
  lcd_init();
 {
  steps();  //2 - swich case for opret 3 relay.
}
{ o_p_rl();//1 - swich case for opret 1 relay.
}
}
} // End Main

But work only:
Quote:
steps(); //2 - switch case for operate 3 relay

not work:
Quote:
o_p_rl();//1 - switch case for operate 1 relay.


But when I use like this:
Code:

void main()
{
   disable_interrupts(GLOBAL);
etc
:
:   enable_interrupts(GLOBAL);   while (TRUE)
{
 lcd_init();
{
  o_p_rl();//1 - switch case for operate 1 relay.
}
{
 steps();  //2 - switch case for operate 3 relay.}
}
} // End Main



Then work only:
Quote:

o_p_rl();//1 - switch case for operate 1 relay

Please guide me.
_________________
sahu
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Sun Jan 22, 2012 5:59 pm     Reply with quote

Hi sahu77,

Your recent plea for help has gone unanswered because I doubt anyone has a clue what you're asking. Your code snippets are horribly formatted, and really don't illustrate what's giving you trouble. If it's tough to read, people aren't going to bother to offer help! Spend some time browsing the forum, and learn how to properly format your code for readability!

I'd suggest that you rephrase the question, and show your code in a format that can actually be read, and followed by the forum members. I realize that English is probably not your first language, but it sure doesn't help when your posts are fully of cryptic words due to misspellings! The forum software will help you here. If a word is misspelled, it will appear with a red underline. Right-click the word, and select the correct spelling.

If your question is again about 'Switch' statement functionality, you can do yourself a huge favor and add some diagnostic printf's to your code that will allow you to see the pathways the code is following. These types of issues can generally be resolved in minutes once you see what's going on!

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group