Bitwise operation

Status
Not open for further replies.

Jyothi@Pic

New Member
Hi,


my code is

#ifndef BITNUM
#define BITNUM(adr, bit) ((unsigned)(&adr)*8+(bit)) /* used for port defs*/
#endif

static bit CH_OUT @ BITNUM(PORTC,4);
static bit ra1=0;

void main()
{

CH_OUT=~(ra1);


}

This code is written in PICCLITE compiler i am getting an error

The error is" illegal operation on bit variable"


can any body tell
how to use biwise operator in PICCLITE compiler for PIC16F877A
 
I'm not familiar with that compiler but tilde (~) is normally the twos complement and so ~0 = 0xff. Try CH_OUT=!(ra1);

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