Hi folks,

Here is some code. I am looking for some wisdom. It runs great. ONCE. It appears that the variable is either never counting to "300", or not getting reset to "10". The input causes the other output to go high, as it should, in a very repeatable manner.
Ideas?
Gary

DEFINE OSC 4
ANSEL=%00000000
CMCON=7
trisio = %00000100

' Chubb input gpio.5
' Output to panel - Trig var gpio.2
' Photo Guy gpio.4
input gpio.5
Chubb var gpio.5
output gpio.4
Led var gpio.4
low led
output gpio.2
Trig var gpio.2
low trig

'Variable for the photo guy
x var word
x = 10

' Test the photo guy
PAUSE 2000
HIGH LED
PAUSE 250
LOW LED
PAUSE 250
HIGH LED
PAUSE 250
LOW LED
PAUSE 2000

'start here
loop:
if Chubb = 0 then
high trig
endif

if Chubb = 0 then
if X < 11 then
X = 12
gosub cola
endif
endif

if chubb = 1 then
low trig
endif

if x > 11 then
x = (x + 1)
endif

if x >= 300 then
x = 10
endif

if x = 100 then
GOTO foto1
endif

pause 100
goto loop
end


foto1:
high led
pause 100
low led
pause 250
high led
pause 100
low led
return
goto loop

cola:
high led
pause 100
low led
return
goto loop
end