Function Question

Discussion in 'Programmer's Corner' started by davis1d0, Apr 14, 2009.

  1. davis1d0

    Thread Starter New Member

    Mar 24, 2009
    I'm working with a PIC18F4520. My question is less how to make my code work but a clarification on an instruction.

    I wanted to shift my value to the right twice to divide by 4, but the only function I'm finding is the Rotate w/ or w/out carry. This does not seem of offer what I'm looking for as it puts the LSB back in the reg as the MSB.

    Can someone tell me if I correct in my understand?

    I truly hope that I'm wrong.

  2. AlexR

    Well-Known Member

    Jan 16, 2008
    You are perfectly correct in your assumptions. The work around it to use the rotate through carry instruction making sure you clear the carry bit before each rotation.