Hello

Good answer bruce, really good one

Any way, to solve your problem, here is what you have to do, as it worked for me:

1. Read portb.
2. Clear the GIE and portb on change IE bit.
3. Pause for, say 100 to 150 ms, to ensure that the user has releasd the button.
4. Do what you want to do. Use the first value you read for portb.
5. Now set RB on change IE bit.
6. Then read portb again, to clear any "may be" pending interrupts, don't try to read portb before enabling RB IE bit, as this is certainly will not be sufficent.
7. Resume will enable GIE bit.

I wish I had that code, I formatted the C partition, and forgot to move some files, that was one of them