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 testing

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



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

#bit testing
PostPosted: Fri Nov 11, 2011 11:17 am     Reply with quote

Hi,
Wondering why I can't do this:

Code:
#byte CCP6CON = 0xF71
#bit CCP6IF = PIR4.1
#bit CCP6M0 = CCP6CON.0


and in my code:

Code:
   if (CCP6MO++) {
      rise3 = CCP_6;
   } else {
      fall3 = CCP_6;
}



I have to do this instead, using an int1 iRise3: I thought by using #bit I would save a few instructions. I thought #bit variables worked like an int1?

Code:
   if (iRise3++) {
      rise3 = CCP_6;
      CCP6M0 = 0; // Set for capture on falling edge
   } else {
      fall3 = CCP_6;
      CCP6M0 = 1; // Set for capture on risiing edge
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 11, 2011 1:50 pm     Reply with quote

Change the font for your text editor so it has a slashed zero.
Then you will more easily be able to see if you typed a zero or a capital O.
The FixedSys font has a slashed zero.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Nov 11, 2011 4:31 pm     Reply with quote

PCM programmer wrote:
Change the font for your text editor so it has a slashed zero.
Then you will more easily be able to see if you typed a zero or a capital O.
The FixedSys font has a slashed zero.
The suggestion was a bit too cryptic for me to pick up at first time, but yes, on my old v4.077 the first code compiles when I fixed the typo in the variable name. Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 11, 2011 4:42 pm     Reply with quote

I know. I answered that way because I mischievously wanted the O.P.
to look closely at his variable names. Cool
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Nov 11, 2011 5:56 pm     Reply with quote

You are terrible. Cool
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