If you just need to know which pin changed, you can
use something like -
DeltaPortA = OldPortA ^ PortA
If DeltaPortA > 0 THEN
OldPortA = PortA
BitThatChanged = NCD DeltaPortA
EndIF
BitThatChanged will have a number from 1-8, corresponding to the bit that changed.
If more than one changed, the highest-order bit that changed will be in the variable.
If you need to know ONLY if it went from LOW to HIGH, you can use
DeltaPortA = OldPortA ^ PortA
If DeltaPortA > 0 Then
OldPortA = PortA
DeltaLowToHigh = DeltaPortA & PortA
BitThatChangedH = NCD DeltaLowToHigh
EndIF
BitThatChangedH will contain the number (1-8) of the highest order bit that changed from low to high.
You can use the same technique for figuring out which one went from HIGH to LOW.
Bookmarks