I am relativley new to programming and am trying to make a simple timing circuit with a PIC12F675. I have written some code that uses a potentiometer and the AD converter to scroll through the time range based on the conversion.

The only problem is i cannot control the range that the time is for(at least i couldn't figure the math out to do so).

Is there anyone that thinks they might be able to help. I will post the code below. I appreciate any and all suggestions.

MAIN:
A1 = %00000000
GOSUB READ_A_D_AN0
LOAD_OUT = 1 ' ON FIRST TRIGGERABLE
PAUSE 100
BUTTON MAIN_TRIGGER, 1, 255, 0, a1, 0, RUN
GOTO MAIN



TIME:
FOR DELAY = 0 TO COUNTER STEP 1
PAUSE 10
GOSUB READ_A_D_AN0
NEXT DELAY
RETURN



RUN:
PAUSE 10
LOAD_OUT = 0
GOSUB TIME
PAUSE 10
GOTO MAIN






READ_A_D_AN0: 'used for Time Delay 1
PAUSEUS 50 ' wait 50 microsec
ADCIN 0, AD_AN0_VALUE ' read channel 0 to AD_AN0_VALUE
COUNTER = (AD_AN0_VALUE */ 1000) >> 2

RETURN