Not as elegant as Dave's... but why do it in one line when you can do it in ten (Ski is not allowed to answer that one)...
Code:
PushButton var PortB.0 ' Low when Pressed
DIPSwitch var PortB.1 ' Low when ON
LED var PortB.2
TRISB=%00000011
Low LED ' Start with LED OFF
Loop: If PushButton=0 then ' Check for Button Press
If DIPSwitch=0 then ' Check for Options
High LED ' Turn ON LED with Button Press...
While PushButton=0:Wend
' Wait here as long as Button pressed
Low LED ' then turn OFF LED
else
Toggle LED ' Toggle LED at each Button Press
While PushButton=0:Wend
' Wait here until finger released from Button
endif
endif
Goto Loop
End
Bookmarks