some thing like this I think and your on the wrong forum
DC_Loops = 20
Main:
ADC_Channel = 1 ' ADC on first reference
GoSub ADC_Average ' Perform an averaging to enhance accuracy
Temp_Float = ADC_Result ' Store the result
ADC_Channel = 0 ' ADC on second reference
GoSub ADC_Average ' Perform an averaging to enhance accuracy
ADC_Result = ADC_Result * 5000 / 1023 ' Convert values into Volts (with a scale of 1000)
Temp_Float = Temp_Float * 5000 / 1023 ' to reduce decimal error
ADC_Result = ADC_Result - Temp_Float ' And calculate difference
ADC_Result = ADC_Result / 10 ' Scale back down remembering 10mV = 1 Deg C
If ADC_Result <> Last_Result1 Then ' Check if the data has changed
Print At 1,1, DEC1 ADC_Result, 0, "C " ' and only update display if it has
Last_Result1 = ADC_Result ' Store new data
EndIf
GoTo Main ' Loop for ever
ADC_Average: ' Perform an averaging on ADC conversions
' to reduce errors
ADC_Total = 0 ' Clear summing register
For Temp = 1 To ADC_Loops ' Loop for a pre-determined number of times
ADC_Result = ADIn ADC_Channel ' Grab a new ADC value
ADC_Total = ADC_Total + ADC_Result ' Sum it to the total register
DelayUS 1 ' Allow internal capacitors to discharge
Next Temp
ADC_Result = ADC_Total / ADC_Loops ' Determin the average of all the equations
Return
Bookmarks