no this is not the entire programs i have my defines set as follows
'Definitions'
DEFINE OSC 4
DEFINE ADC_BITS 10 ' set number of bits in result
DEFINE ADC_CLOCK 3 ' set clock source
DEFINE ADC_SAMPLEUS 50 ' set sampling time for microseconds
'Definitions'
'Register Initializations'
ADCON0 = %10000011
ANSEL = %00000011 ; A to D on AN0 and AN1
'ANSELH = %00001100
CMCON = %00000111
TRISIO = %00011111 ; define Inputs and Outputs
GPIO = %00000000 'set all pin states to off
'OPTION_REG = %11100000
WPU = %00000000
'Register Initializations'
'Variables'
LOAD_OUT VAR GPIO.5
DELAY VAR WORD
COUNTER VAR WORD
AD_AN0_VALUE VAR WORD
MAIN_TRIGGER VAR GPIO.2
A1 var Byte
i var word
im trying to achieve multiple time ranges. for example 0.5 sec to 5 sec, and i want to use the pot to adjust in that range.
But when i do the AD conversion it is giving me a number between 0 and 1024. But inorder to get my specific range i need a value of 50 to 500.
I am basically trying to figure out a way to spread the 50 to 500 range out over the full 0 to 1024 range so i get the same resolution and get my two endpoints of 50 and 500.
I have also changed thge code as follows.
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
PAUSE 100
GOTO MAIN
TIME:
for i = 1 to counter step 1
FOR DELAY = 1 TO 10 STEP 1
PAUSE 1
GOSUB READ_A_D_AN0
NEXT DELAY
next i
RETURN
RUN:
PAUSE 10
LOAD_OUT = 0
GOSUB TIME
PAUSE 10
GOTO MAIN
I appreciate the help, thank you very much.
Bookmarks