Darrel's oversampling code and info can be found here: http://www.darreltaylor.com/DT_Analog/
Attached is his file that takes multiple samples from the A/D converter, and can "oversample" from 10 to 16 bits resolution. It is pretty slick, as it can make a 16 bit A/D converter out of a $1.50 PIC12F683.
'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : Walter Dunckel                                    *
'*  Notice  : Copyright (c) 2009 Scale Robotics Inc.            *
'*          : All Rights Reserved                               *
'*  Date    : 6/3/2009                                          *
'*  Version : 1.1                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
@ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_OFF & _CP_OFF
DEFINE OSC          8
DEFINE ADC_BITS     10  '10 BIT A/D CONVERSION RESULT
DEFINE ADC_CLOCK    2   'INTERNAL A/D RC CLOCK
DEFINE ADC_SAMPLEUS 5   'SET SAMPLE TIME IN MICROSECONDS
INTCON = %10001000 'internal oscillator
OSCCON = %01110000              'set for 8mhz internal
CMCON0 = 7               'TURN COMPARITORS OFF
TRISIO = %010000        'Set GSIO 4 INPUT, others to OUTPUT
ANSEL = %01011000         '
ADCON0.7 = 1            'Right Justify for 10-bit
ADCON0 = %10001101       'analog 3 channel
INCLUDE "DT_Analog.pbp" ; DT's 16-bit Analog Module
PIR1.0 = 0 
dEFINE DEBUG_REG    GPIO
dEFINE DEBUG_BIT    0
dEFINE DEBUGIN_BIT    1
DEFINE DEBUG_BAUD    38400
DEFINE DEBUG_MODE    0
ALTresult       var word   'lookup table output
tempALT         var word   'base altitude of lookup from table
ADtemp          var byte   'lookup table input
ALTdifference   var word   'difference of two nearby altitudes
finalALT        var word   'final calculated altitude in feet
LeftShift       var byte   'shifts ADvalue to match lookup table
tempword        var word
metric          var bit 
symbol i = ADtemp           'share byte
symbol LEDcount = tempALT.byte0
symbol pulses = tempALT.byte1   'share byte
'test            var byte
metric = 0                 'specify metric =1 for metric & 0 for feet
ADbits = 16             'specify oversampling bits (10 to 16)
ADchan = 3                 'ANchannel your MPX4115a is on
GPIO.5 = 0
LED var GPIO.5
Main:
    led = 0
    GOSUB GetADC            ' Get A/D value
    leftshift = 16 - ADbits ' calculate number of shifts required
    ADvalue = ADvalue << leftshift 'shift to match 16 bit lookup table
    ADtemp = ADvalue/1000 - 15  ' get to right value for lookup
    gosub lookmeup
    tempALT = ALTresult    'save first result for use in math
    ADtemp = ADtemp - 1 'run second lookup for alt difference calc
    gosub lookmeup
    ALTdifference = ALTresult - tempALT   'get difference in nearby alt
    'use difference to calculate slope & adjust altitude accordingly
    finalalt = (ADvalue//1000)* altdifference 
    tempword = div32 100
    finalalt = tempword/10
    if tempword//10 >= 5 then finalalt = finalalt + 1 'round remainder
    finalALT = tempalt - finalALT
    if metric = 1 then finalALT = (finalalt * 25)/82 'feet to meters
    debug "ALT ",DEC finalALT,13,10
    gosub LEDout
    
GOTO Main:
End
lookmeup:
  lookup2 ADtemp,[25989,24934,23921,22942,21995,21078,20190,19327,18489,17673,_
  16879,16106,15351,14615,13896,13194,12507,11834,11176,10532,9900,9280,8672,_
  8076,7490,6915,6349,5794,5247,4710,4181,3660,3148,2643,2145,1655,1172,696,_
  226],ALTresult
return
LEDout:
    for i = 4 to 0 step -1
    ledcount = finalalt dig i
    if ledcount > 0 then 
        gosub LEDpulse
    else
        led = 1
        pause 4
        led = 0
        pause 596
    endif
    next i
    pause 1000
return
    
    
LEDpulse:
    for pulses = 1 to ledcount 
        led = 1
        pause 200
        led = 0
        pause 400
    next pulses
    pause 600
return
end


 Menu
 Menu 
			
			
 
			 
			 
			
Re: 16F690 MCLR as Input
many thanks Henrik to clarify this post.
jackberg1 - 27th October 2025, 20:42that make more sense to me now with further test, when the pin RA3
has nothing connected to it, the input is floating thus
when adding a pulldown it's...