Try this. I have not tested though, but is based on Roberts idea to work as you requested. Roberts idea will toggle the output everytime the switch will change state. Not on 0->1 only.
IoannisCode:SwitchIn VAR PortB.0 OldState VAR BIT SwitchState VAR BIT OldState = SwitchIn SwitchState = 0 Main: IF SwitchIn not = OldState THEN IF SwitchIn THEN SwitchState = SwitchState ^ %1 ' Switch has been toggled ENDIF ENDIF OldState = SwitchIn GOTO Main
Bookmarks