On Thu, Mar 12, 2015 at 3:17 PM, Charles Craft wr= ote: > If you have the space, why not put all eight bits in the table? There are actually only 2 bits that I'm worried about. In this particular case, they are the two LSB of the PWM value for the CCP/PWM peripheral. The MSB 8 bits are easy to load as they are a full byte, the LSB go in a control register that has other functions. So I can't just overwrite that and expect everything to work. > Would if be easier to read if you combine your mask and value into one va= riable > then AND that with "target"? That wold be cool, but because the starting state of the target register isn't guaranteed, won't I still end up in a situation where I need to mask and combine? > or define "target" with bit fields and set the field equal to value? > http://en.wikipedia.org/wiki/Bit_field This could be interesting. I hadn't thought about defining a multi-bit field and just writing to it. If I did the definitions correctly, would: TARGETbits.PWMLSB =3D arrayofvalues[index]; work, or would I still need to shift to align the array value with the bits I'm actually loading? My guess is that I shouldn't have to shift, but I am unsure. Thanks! Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .