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

Expecting a close paren

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







Expecting a close paren
PostPosted: Mon Jan 25, 2010 5:29 pm     Reply with quote

Code:
void Write_Register (unsigned char RegAddress, unsigned char DLength)
{
  unsigned char ByteCounter,
                BitMask,
                *PtrHighByte;
  /*---------------------------------------------------------------------------------*/
  /*    Preparing to send the data                                                   */
  /* Calculate the position of the MSB to send */
  /*    Beginning the register read or write cycle                                   */
  BitMask = 0x000001;
  ByteCounter = 0;
  if (DLength != 0)
  {
    while (--DLength)
      if ( (BitMask <<= 1) == 0)
      {
          BitMask = 0x000001;
          ByteCounter++;
      }
  }
  *PtrHighByte = ((unsigned char*)input(DIN))+ByteCounter;
                                                 /* It's a register Write cycle */ 
  /*---------------------------------------------------------------------------------*/
  /*    Sending the new register value                                               */
  /* Note : DLength is now used to signal the end of the emission */
  delay_ms(10);
        /* Start sending the DLength data bits to the 01 register */

    write_bit((*PtrHighByte & BitMask) != 0); /* Send the Bit Value */    {
    if ( (BitMask >>= 1) == 0)
    {                          /* Prepare to test next bit */
        BitMask = 0x800000;
        PtrHighByte--;
        if ((ByteCounter--) == 0)
            DLength = 1;
    }
    }
    while (DLength != 1);  /* Have all the data bits been sent ? */
 
}
/* Return from subroutine */

Hi, I have a problem with 'Expecting a close paren' in 'write_bit((*PtrHighByte & BitMask) != 0); ' I couldn't find out where the error is. I want to call the function 'write-bit' I wrote. Could you help me with this? Thank you very much!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 25, 2010 5:38 pm     Reply with quote

My advice is to get rid of all the * comments (delete them all)
and clean up the formatting on the code. Then you should be
able to easily spot the problems.
Guest








PostPosted: Mon Jan 25, 2010 9:01 pm     Reply with quote

PCM programmer wrote:
My advice is to get rid of all the * comments (delete them all)
and clean up the formatting on the code. Then you should be
able to easily spot the problems.


why is that?
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Jan 25, 2010 9:06 pm     Reply with quote

Because the /*comments*/ are making it hard to see the cause of the error.
I can see it but he was wanting you to see it for yourself.

It was because of this type of problem I started to avoid using /* a long time ago
and started using // for comments
_________________
Google and Forum Search are some of your best tools!!!!
Ttelmah
Guest







PostPosted: Tue Jan 26, 2010 3:29 am     Reply with quote

It is a question slightly of what you are doing 'with' the comments.
Reserve /*, and */, for 'block comments' before the start, or after the end of the code, using multiple lines. For 'in line' comments, use //. This is especially worthwhile, if you are using pointers in a code block.
Good formatting, and use of comments, helps to simplify seeing errors, and reading the code. In line use of /* */, doesn't help this, and add a bit of strange formatting, and everything becomes much harder...

In this case, just count the brackets on each code line.
Remember that errors like this, often actually reflect an error earlier in the code.

Best Wishes
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Jan 26, 2010 10:48 am     Reply with quote

There are also editors to help you match braces and paren's.

What editor are you using to work on your code?

I like UltraEdit32, MPLAB and vi (Unix).

-ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
GiGI
Guest







PostPosted: Tue Jan 26, 2010 12:19 pm     Reply with quote

Thank you guys.
With your help, I found the error which exists in the function of 'write_bit'.
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