keep in mind that if your're working with more than one input, one that is an "enable", for example, that you can use a logical operator to make some magic...


if portb.0 <> buttonState AND portd.3 = 1 THEN... etc.

In one case I needed to validate what was going on with a variable that came from the HSERIN and had to use some intense logic...

If (BtVar = 48 AND porte = 0) OR (BtVar = 49 AND porte = 1) OR (BtVar = 50 AND porte = 2) ... THEN...

This let me match the port e value to the character that came in on the serial port. Since Port e on an 16F877A is 3 bits, I needed to compare for all 8 values using this if-then. It's incredible what tis complier and the chips, for that matter can do!

good luck.
J.-