At 02:58 PM 23/11/2011, you wrote: >I was planning to use the internal CVREF on the 18F26K20, but I'm >confused by microchip's documentation. On page 291: > >CVRR: Comparator VREF Range Selection bit >1 =3D 0 to 0.667 CVRSRC, with CVRSRC/24 step size (low range) >0 =3D 0.25 CVRSRC to 0.75 CVRSRC, with CVRSRC/32 step size (high range) > >When CVRR =3D 1: >CVREF =3D ((CVR<3:0>)/24) * (CVRSRC) + VREF- >When CVRR =3D 0: >CVREF =3D (CVRSRC/4) + ((CVR<3:0>)/32) * (CVRSRC) + VREF- > >With 4 bits, 15 being the maximum CVR value, how can you get .667 >CVRSRC? I get the value of .625 CVRSRC max. >When CVRR =3D 0, I again get 0.71875 CVRSRC and not .75 as advertised. > >It looks like they plugged 16 into the formula to get .667 or .75 >CVRSRC values. > >The datasheet in question is available here: >http://ww1.microchip.com/downloads/en/DeviceDoc/41303G.pdf > >I haven't tried it in circuit yet, or looked at any other datasheets. Your numbers are correct, based on figure 21-1 as well as the numbers in the Midrange Reference Manual (Table 19-1), which shows a voltage of 3.13 V with VRR=3D1 and 1111 for VR3:VR0 (Vdd =3D 5.0V) Best regards, Spehro Pefhany --"it's the network..." "The Journey is the rewar= d" speff@interlog.com Info for manufacturers: http://www.trexon.co= m Embedded software/hardware/analog Info for designers: http://www.speff.co= m --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .