to set a bit

Status
Not open for further replies.

srikanthind

New Member
i got a very basic doubt, i could not find all list of instructions, is there any instruction or datatype to set a particular pin in pic c (like BSF in assemble ), I tried with sbit, it didn't work.


could you give me the link where i can find the all instructions.

thank you
 
Depends on the bit.... If its an SFR its been defined ie.. PORTA has RA0, RA1, RA2...etc

Or you can specify PORTB.RB1 etc...

If you need to specify undefined bits in a byte.... Then you need to create a struct or union to access them

Code:
struct {
    unsigned mybit1:1;   // 1 bit
    unsigned mybit2:1;
    unsigned mybit3:1;
    unsigned mybits4:2;   // 2 bits
    unsigned mybits5:3;  // 3 bits
  };
} MYBYTEbits;
 
thank you
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…