Hi

I would like to make a menu where I can setup a calibration table for a voltage read from the ADC from a non linair RF power detector

example:

Power is 10W (RF power) detected by an RF detector which give a voltage out and goes to an ADC, the ADC give 105 as value
when I read the ADC I want to increase a value by a push button (UP) to a value of 10 which is equal to 10w and store this as calibration point 1 (so 10W = ADC 105)

Then I go to the next calibration point,2 the real RF power now is 20W
again I read the ADC (gives 310) and increase a value by a push button (UP) to 20w which is the real power and store this as calibration point 2 (so 20W = ADC 310)

I will end with 10 calibration points

Now if I have during normal measurement an ADC value of 210 i can calculate the power (aprrox) from the calibration point data

For the first part I have this code:

start_calibration:
for i = 1 to 10
Calibrate:
button enter,0,20,1,bvar,0,idle
pause 50
next i
pause 50
idle:
pause 50
ADCIN 0, adval0
Lcdout $fe, 1 ' Clear screen
LCDOUT "Calibration point ",#i
LCDOUT $FE,$c0
LCDOUT "Enter ",DEC4 adval0," => ",DEC3 calpwr[I]," W"
button up,0,20,1,bvar,0,calibrate
calpwr[i] = calpwr[i]+1
pause 50
if calpwr[i] > 200 then
Lcdout $fe, 1 ' Clear screen
LCDOUT "Calibration routine: "
calpwr[i] = 1
endif
goto calibration