Jan-Erik, I guess my next question is about packing the register. The RA0-1=20 and RB0-1 bits are my inputs. On Port A the output pins are 2-3 and 6-7.=20 On Port B it is 2-5. So if I have two output registers. One called=20 OutputA and the other OutputB. When the input is 0-0 then the output is=20 1-0-0-1. If the input is 0-1 then the output is 0-0-1-0. If it is 1-0=20 the output is 0-1-0-0 and if it is 1-1 the the output is 1-0-0-0. I=20 guess we should define some constants called Bit# such as Bit0, Bit1,=20 Bit2 and so forth to Bit7. These should be set to 1, 2, 4, 8, and so=20 forth up to 128. We first have to clear the registers to zero with=20 OutputA or B =3D 0; So do we add RA, B 0 and 1 together? And here is where= =20 I get lost. I just don't understand how to turn RA and B 0 and 1 in to=20 the proper number to put into the output bits. Would you please help me=20 with this. Thanks, rich! P.S. This is how it should look. --------------------------------- ---------------------------------- | Input | Output | =20 | Input | Output | | Bits | Bits PortA | =20 | Bits | Bits PortB | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|-----|------| | 1 | 0 | 2 | 3 | 6 | 7 | =20 | 1 | 0 | 2 | 3 | 4 | 5 | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|-----|------| | 0 | 0 | 1 | 0 | 0 | 1 | =20 | 0 | 0 | 1 | 0 | 0 | 1 | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|------|-----| | 0 | 1 | 0 | 1 | 0 | 0 | =20 | 0 | 1 | 0 | 1 | 0 | 0 | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|------|-----| | 1 | 0 | 0 | 0 | 1 | 0 | =20 | 1 | 0 | 0 | 0 | 1 | 0 | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|------|-----| | 1 | 1 | 0 | 0 | 0 | 1 | =20 | 1 | 1 | 0 | 0 | 0 | 1 | |-----|-----|-----|-----|-----|-----| =20 |-----|-----|-----|-----|------|-----| Thanks, rich! On 9/13/2015 6:00 AM, Jan-Erik S=F6derholm wrote: --=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 .