Hi Ed, Could you explain a bit more what you are trying to do? 14 bit words means each address addresses 14bit words, other words you do not need division or whatever to pick up one byte. Or you are trying to split up the bytes to bit streams to compress the data (and reading the flash with eeprom reading method)? Tamas On Thu, May 8, 2008 at 4:59 PM, Ed Sutton wrote: > 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 > > > Patterns: > > The 14-bit words and 8-bit data have a common multiple of 56. > The wordBitOffset pattern { 0,8,2,10,4,12,6 } repeats every 7-bytes. > I can't see a solution but it is an interesting puzzle. > > Thanks in advance for any tips or suggestions, > > -Ed > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Rudonix DoubleSaver http://www.rudonix.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist