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 support@ccsinfo.com

#bit directive not working

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



Joined: 18 Jan 2007
Posts: 9

View user's profile Send private message

#bit directive not working
PostPosted: Thu Feb 15, 2007 2:09 pm     Reply with quote

Compiler: PCWH 4.024
Part #: PIC16F913
Oscillator: 20MHZ

Why when I try to use the #bit directive multiple times inside a function, the compiler gives me the error "A numeric expression must appear here".
Code:

   int ch;
   #bit ch_0 = ch.0;
   #bit ch_1 = ch.1;
   #bit ch_2 = ch.2;
   #bit ch_3 = ch.3;
   #bit ch_4 = ch.4;
   #bit ch_5 = ch.5;
   #bit ch_6 = ch.6;
   #bit ch_7 = ch.7;


if I only use one #bit it does not complain
Code:

   int ch;
   #bit ch_0 = ch.0;
/*   #bit ch_1 = ch.1;
   #bit ch_2 = ch.2;
   #bit ch_3 = ch.3;
   #bit ch_4 = ch.4;
   #bit ch_5 = ch.5;
   #bit ch_6 = ch.6;
   #bit ch_7 = ch.7;
*/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 15, 2007 2:32 pm     Reply with quote

Quote:
int ch;
#bit ch_0 = ch.0;

Actually, it will give an error for that one too.

Download the CCS compiler manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look in the section on the #bit directive.

Does CCS show anything at the end of the line on a #bit declaration ?
What character do you have at the end ?
jksor1234



Joined: 18 Jan 2007
Posts: 9

View user's profile Send private message

PostPosted: Thu Feb 15, 2007 3:03 pm     Reply with quote

I must have stared at the manual for a half an hour before I wrote this post... can't believe I didn't see there wasn't a semi-colon.

Thanks
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