Hi,
It seems difficult to handle the 4 switches i.e B1, B2, B3, B4 (assuming the image shows push button switches) through 2 pins of the PIC.
However this problem can be resolved can be attemepted by following 2 ways:
Approach 1:
Either use on off switch instead of push button switch, in that case based upon binary combinations possible for 6 pins i.e 2^6 combinations would be possible using on/off status of each push button switch.
like
Pin 1(B1 on/off) | Pin 2(B1 on/off) | Pin 3(B1 on/off) | Pin 4(B1 on/off) | Pin 5(B1 on/off) | Pin 6(B1 on/off) | Pattern |
on | off | off | off | off | off | 1 |
off | on | off | off | off | off | 2 |
off | off | on | off | off | off | 3 |
Based upon the binary code, the action can be taken in code logic.
Approach 2:
Through ADC channels.
The on off switches can be arranged with a mesh resistors.
Based upon the switch on off conditions new resistirs shall be introduced into the circuit their by reduding/ increasing the effective analog voltage available at ADC channel.
A simple example has been suggested below:
Hope this is helpful..:smile: