Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top