Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top