Quoting Ed Sutton <
esutton@...>:
> Are there other ways to implement a divide by a 14 constant other than
> cycle-chewing subtraction loops?
>
> I want to use the PIC16F flash consisting of 14-bit words to store 8-bit
> data. I can implement the multiply-by-8 as a shift. The crux of the
> problem is basically the divide by a constant of 14.
>
> Pseudo Code ( actual code will likely be assembly )
>
> wordOffset = 8*byteOffset / 14; // The integer result
> wordBitOffset = 8*byteOffset % 14; // The remainder result
Since you need both the quotient and the remainder, and cannot tolerate
any error in either, I think a conventional shift-and-subtract
division routine
will work pretty well and will generate both numbers at once. Did you
check the PICLIST code library?
Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
s...@... Info for manufacturers:
http://www.trexon.comEmbedded software/hardware/analog Info for designers:
http://www.speff.com--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist