Searching \ for 'RLF, RRF' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=rlf+rrf
Search entire site for: 'RLF, RRF'.

Truncated match.
PICList Thread
'RLF, RRF'
1999\01\18@204001 by Anthony Buckwell

flavicon
face
I should know the answer to this as ive done it few times but.

Im have trouble with the rotate commands on the PIC16C77.
When rotating a bit left for example it will add a bit in the lsb when
rotating left and in the HSB when rotating right, even thought manual
demonstrates that it doesnt.

tis is whats happening,
clrf    BITn
bsf     BITn, 0
(BITn=0000 0001)

rlf     BITn, f

My mistake???
somthing simple???.


(BITn= 0000 0011)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Anthony Buckwell                        E-Mail: spam_OUTa.buckwellTakeThisOuTspamcat.csiro.au
Electronic Engineer
Exploration and Mining, QCAT
CSIRO Australia

2643 Moggill Road, Pinjarra Hills QLD 4069
PO Box 883 Kenmore QLD , 4069 Australia
PH: +61 7 3212 4769     Mobile 0419 783 109
FAX:+61 7 3212 4455
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1999\01\18@205052 by Jim Robertson

flavicon
face
At 12:27 19/01/99 +1100, you wrote:
>I should know the answer to this as ive done it few times but.
>
>Im have trouble with the rotate commands on the PIC16C77.
>When rotating a bit left for example it will add a bit in the lsb when
>rotating left and in the HSB when rotating right, even thought manual
>demonstrates that it doesnt.
>
>tis is whats happening,
>clrf    BITn
>bsf     BITn, 0
>(BITn=0000 0001)
>
>rlf     BITn, f
>
>My mistake???
>somthing simple???.


Clear the carry flag. That is being shifted into B0. That's simple. :-)
rlf and rrf are 9 bit rotations, not 8-bit rotations.


Jim

{Quote hidden}

--------------------------------------------------------
Jim Robertson
Email: newfoundspamKILLspampipeline.com.au

http://www.pipeline.com.au/users/newfound
--------------------------------------------------------

1999\01\18@210126 by Harold Hallikainen

picon face
       The ROTATE instructions rotate thru the carry.  You can either
clear the carry prior to the rotate, or (especially if you're rotating
more than once) AND the result with a mask to clear the appropriate bits.

Harold



Harold Hallikainen
.....haroldKILLspamspam.....hallikainen.com
Hallikainen & Friends, Inc.
See the FCC Rules at http://hallikainen.com/FccRules and comments filed
in LPFM proceeding at http://hallikainen.com/lpfm

On Tue, 19 Jan 1999 12:27:48 +1100 Anthony Buckwell
<EraseMEa.buckwellspam_OUTspamTakeThisOuTCAT.CSIRO.AU> writes:
{Quote hidden}

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1999\01\18@210956 by Mike Keitz

picon face
On Tue, 19 Jan 1999 12:27:48 +1100 Anthony Buckwell
<@spam@a.buckwellKILLspamspamCAT.CSIRO.AU> writes:

>Im have trouble with the rotate commands on the PIC16C77.
>When rotating a bit left for example it will add a bit in the lsb when
>rotating left and in the HSB when rotating right, even thought manual
>demonstrates that it doesnt.

The manual says very clearly in several places that the PIC takes the
value of the C flag in the STATUS register and uses it for the "new"
leftmost or the rightmost bit of the result.  The bit that "falls out" of
the register is then placed into C.  This is very useful for propagating
bits through a rotate of multiple bytes.  But if you are doing the first
or only byte and need to be sure to rotate in a zero or a one, clear or
set C first.

Many processors have several types of shift and rotate operations, but
the PIC only has this one.

To do an 8 bit rotate, C has to be set equal to the value of the bit at
the other end first.  For example to rotate left, set C = bit 7, then
rlf.  There are two major ways to do that:

       rlf     var,w           ;C=bit7, ignore result in W
       rlf     var,f           ;Complete the 8-bit rotate

or

       clrc                    ;Asssume rotating in a zero
       btfsc   var,7           ;Yes, last bit is 0
       setc                    ;Bit 7 = 1, put a 1 in bit 0
       rlf     var,f

The first method is shorter and faster, but it erases data you may have
needed to keep in W.  The second method doesn't affect W.  Both methods
affect C but not Z (another common PIC programmer's mis-assumption:
unlike many processors, rotates *don't* affect Z!)


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1999\01\18@220951 by Peter Grey

picon face
At 12:27 PM 19/01/99 +1100, you wrote:

The rlf/rrf are a rotate through CARRY. That is, whatever is in the carry
bit will be moved into the lsb (RLF0 or msb(RRF). also the bit that is
rotated out of the register is loaded into the carry bit.

good luck,


Peter Grey
Neosystems

{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...