Sorry, my mistake...
The best way is to use mask variable, like this:
bit test_bit;
byte mask;
void funtion(void)
{
if(test_bit == 0)
{
mask=0b00000001;
}
else
{
mask=0b00000010;
}
}
and testing/setting values this way:
Set:
Clear:
Read value:
value=(GPIO & mask)?1:0;
or simplier - if (GPIO & mask) {...}
I don't know the CC compiler syntax, but in MCHP C I'm using constructions like "PORTB |= mask;" (or "LATC=PORTC|mask;" with C18)
If you need to use two different ports, you must use pointer to memory area where desired port is mapped...
I apologize for my mistake once more, hope this helps...