Bit manipulation in C18

Status
Not open for further replies.

Munib

Advanced Member level 4
Joined
Jun 11, 2004
Messages
114
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
1,129
c18 bit test

How bit manipulation is done by using C18 compiler from Microchip
I mean if i want forexample to test a certain bit in a character whether it is clear or set how to do this in C18

is there any equivalent in C for assembly instructions like BTFSS,BTFSC
etc
 

c18 bit manipulation

I'm pretty sure using logical operations and bitmasks will compile to the proper bit-test instructions.

So for instance

"if(reg&0x08)" will compile to "btfsc reg,3" or something like that.

In the same way, I think "reg |= 0x80" will compile to "bsf reg,7"
 

bit c18

If you want to be sure, you can always use inline assembly.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…