View previous topic :: View next topic |
Author |
Message |
Will Reeve
Joined: 30 Oct 2003 Posts: 209 Location: Norfolk, England
|
#bit testing |
Posted: Fri Nov 11, 2011 11:17 am |
|
|
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
|
|
Posted: Fri Nov 11, 2011 1:50 pm |
|
|
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
|
|
Posted: Fri Nov 11, 2011 4:31 pm |
|
|
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. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 11, 2011 4:42 pm |
|
|
I know. I answered that way because I mischievously wanted the O.P.
to look closely at his variable names. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Nov 11, 2011 5:56 pm |
|
|
You are terrible. |
|
|
|