I need some Ideas On how to monitor two pins, which are hooked to a 4 bit encorder, on pin change of state I need to mirror this change of state on two output pins. These output pins are also used to output the state of another input (toggel sw) which is programmed to output a 4 bit state. this is a manual setup where one encoder or one toggel sw(through programming) will output the 4 bit state (not both at the same time) upon pin change. so if they spin the encoder I want that output to be mirrored if they use the toggel sw I want that part of the program to output the state.
I have the toggle sw working I need to have a second input and which ever one is used takes over the program.

I hope this makes sense to someone!