Shop OBEX P1 Docs P2 Docs Learn Events
Detect change of state - boolean logic — Parallax Forums

Detect change of state - boolean logic

mojorizingmojorizing Posts: 249
edited 2011-06-11 15:18 in Propeller 1
Help me out here.....

to detect a change of state (xstate) on a prop pin it would be the following code for low to high...
xstate := newstate ^ oldstate & newstate   ' detect change of bits, 0->1

what is the logic to detect a change from high to low?

oldstate, newstate, and xstate refer to the states of 4 adjacent pins wired to 4 push buttons held high, going low when pressed.

I could use a bitwise not to invert inputs, but is there other way? I'm cross-eyed from working out truth tables.

Comments

Sign In or Register to comment.