Quote Originally Posted by BobK
...If you want to get real basic here you can read porta like this:

Peek PortA, B0 Read PortA and put results in Variable B0
If Bit0 = 1 then task 1 'Reads PortA pin 0, if 1 then goto task 1
If Bit1 = 1 then task 2 'Reads PortA pin 1, if 1 then goto task 2
If Bit2 = 0 then task 3 'Reads PortA pin 2, if 1 then goto task 3

...
Bob,
Nice addition - your approach is certainly easier and faster to write. Utilizing the fact that Bit0, Bit1, etc. are predifeined as the bits of B0 is the better approach for straightforward (i.e., normal) operations. Thanks for adding - now Dirk has lots of options. If it were me, I would skip the bitwise stuff and use what Bob has above.