Hi DUNCAN,

I have an example here with a button test to show how Toggle behaves.
It is just an example and may give you some clue.

How/where does your TOGGLE command get executed? You are most likely having an issue as below.



Code:
T_C VAR BIT
ButtonX VAR PORTE.0


Loop:
     IF BUTTONX = 0 THEN TOGGLE T_C
     'This will toggle T_C unknown number of times 
     'while the button is being pressed.
     
     
     
GOTO LOOP

Take a look at this code now.


Code:
LOOP:
     IF BUTTONX = 0 THEN
        WHILE BUTTONX = 0 : WEND
        TOGGLE T_C
     ENDIF
    'This will toggle T_C one time once 
    'the button is pressed and released.
     
GOTO LOOP