You are correct...today i do BIT manipulation...but, i want to reduce my
code...
----- Original Message -----
From: M. Adam Davis <EraseMEadavis
UBASICS.COM>
To: <RemoveMEPICLISTEraseME
EraseMEMITVMA.MIT.EDU>
Sent: Tuesday, June 13, 2000 4:59 PM
Subject: Re: [OT]: CCS C COMPILER
> It will affect the output bits, but not the inputs. All the bits are read
in
> the first instance, then the high or low value of the bits you are keeping
are
> re-written to portB, along with the low or high value of the bits your are
> writing to portb.
>
> This can cause a problem in this way:
> Say you've set bit 7 as output, and are driving it high.
> If an external load is driving the pin low (and doing a better job than
the PIC)
> then when you read in PORTB it will report that that pin is low, even
though you
> previously told it to output high. When you write the modified value back
to
> the port it will set that pin low.
>
> See the instructions BCF and BSF from the data sheet. In a nutshell,
ports do
> not exist as registers. If you only modify a portion of a port you will
read
{Quote hidden}> the actual value on the pin, not the intended value.
>
> -Adam
>
> WF wrote:
> >
> > My question is:
> >
> > Will affect the remainder bits? The remainders bits are configurated as
> > INPUT and OUTPUT...
> >
> > Miguel
> > ----- Original Message -----
> > From: Andrew Kunz <
RemoveMEakunzspam_OUT
KILLspamTDIPOWER.COM>
> > To: <
RemoveMEPICLISTTakeThisOuT
spamMITVMA.MIT.EDU>
> > Sent: Tuesday, June 13, 2000 4:42 PM
> > Subject: Re: [OT]: CCS C COMPILER
> >
> > > PORTB = (PORTB & 0x0F) | (NEWVALUE & 0xF0); // Updates high nybble
> > >
> > > PORTB = (PORTB & 0xF0) | (NEWVALUE & 0x0F); // Updates low nybble
> > >
> > > Andy