electromark
- 25th October 2012, 00:40
Thanks in advance to all who help.
Im working on a project where there has to be provisions for the following:
2 sets of momentary pushbuttons:
Set1 ON/OFF (turns an LED on / off)
Set2 ON/OFF (turns an LED on / off)
and 2 toggle buttons:
TOGGLE1 (turns an LED on / off)
TOGGLE2 (turns an LED on / off)
The momentary buttons work like a champ. Im running in to trouble with the toggles. When they activate, the program freezes until they are turned off. I need to, when either or both of the toggle switches are on to continue on with the program- i.e. reading the momentary buttons, ect.
Any help would be appreciated.
part of my code example is below:
do
' PLOW FUNCTION
COUNTER1 = 0 ' Reset count
DO WHILE (PLOWUP = 0) OR (PLOWDOWN = 0) ' Loop while button pressed
PAUSE 1 ' Give the loop a 1mS execution time
counter1 = counter1 + 1 ' Count a loop (1mS)
IF counter1 = threshold1 THEN ' Reached threshold time?
PLOWOUT = PLOWUP
ENDIF
LOOP
' DUMP FUNCTION
COUNTER2 = 0
DO WHILE (DUMPDOWN = 0) OR (DUMPUP = 0) ' Loop while button pressed
PAUSE 1 ' Give the loop a 1mS execution time
counter2 = counter2 + 1 ' Count a loop (1mS)
IF counter2 = threshold2 THEN ' Reached threshold time?
DUMPOUT = DUMPDOWN
ENDIF
LOOP
;switch code in here??
LOOP
Im working on a project where there has to be provisions for the following:
2 sets of momentary pushbuttons:
Set1 ON/OFF (turns an LED on / off)
Set2 ON/OFF (turns an LED on / off)
and 2 toggle buttons:
TOGGLE1 (turns an LED on / off)
TOGGLE2 (turns an LED on / off)
The momentary buttons work like a champ. Im running in to trouble with the toggles. When they activate, the program freezes until they are turned off. I need to, when either or both of the toggle switches are on to continue on with the program- i.e. reading the momentary buttons, ect.
Any help would be appreciated.
part of my code example is below:
do
' PLOW FUNCTION
COUNTER1 = 0 ' Reset count
DO WHILE (PLOWUP = 0) OR (PLOWDOWN = 0) ' Loop while button pressed
PAUSE 1 ' Give the loop a 1mS execution time
counter1 = counter1 + 1 ' Count a loop (1mS)
IF counter1 = threshold1 THEN ' Reached threshold time?
PLOWOUT = PLOWUP
ENDIF
LOOP
' DUMP FUNCTION
COUNTER2 = 0
DO WHILE (DUMPDOWN = 0) OR (DUMPUP = 0) ' Loop while button pressed
PAUSE 1 ' Give the loop a 1mS execution time
counter2 = counter2 + 1 ' Count a loop (1mS)
IF counter2 = threshold2 THEN ' Reached threshold time?
DUMPOUT = DUMPDOWN
ENDIF
LOOP
;switch code in here??
LOOP