Hello,

the complicated way:

MaskSwitch=(PortC & %00000111) | ((PortC & %11000000) >> 3) | ((PortA.0 & %00000001) << 5)


The better way (using the bit-operators of PICs):

MaskSwitch=0
If PortC.0 Then MaskSwitch.0=1
If PortC.1 Then MaskSwitch.1=1
If PortC.2 Then MaskSwitch.2=1
If PortC.6 Then MaskSwitch.3=1
If PortC.7 Then MaskSwitch.4=1
If PortA.0 Then MaskSwitch.5=1


Check out the size !!!

But be aware to press more then ONE key !!!
Then you have to write multiple case-lines !!! ;-)