[time-nuts] uC ADC resolution (was: Poor man's oven)

Magnus Danielson magnus at rubidium.dyndns.org
Sat Jun 10 15:10:15 EDT 2017


Hi,

Very good point Poul-Henning, very good point.
The mux is there, we don't need the resolution far out, and with only a 
little though code-wise and hardware wise we get the best of resolution 
and range where we need it.

Cheers,
Magnus

On 06/10/2017 09:06 PM, Poul-Henning Kamp wrote:
> --------
> In message <3897C09A-D76C-474C-8907-9EA25F8C3451 at n1k.org>, Bob kb8tq writes:
>
>> The “limited range” part of it is why the op-amp makes so much
>> sense. If the ADC can “see” +/-10C that’s way more than will ever be useful.
>
> Most uC's have a pile of mux'ed ADC inputs, so do all of the above:
>
> AI0 = Full range
>
> AI1 = +/- 10C
>
> AI2 = +/- 2C
>
> A big upside to this is that you will not need to invent heuristics
> for clamped inputs in your PI(D) controller, something which is a bit
> harder than most people realize.
>
> Assuming a 10-bit ADC, the code will look something like this:
>
> 	double
> 	get_temp(void)
> 	{
>
> 		T = read_AI2();
> 		if (T > 50 && T < 975) {
> 			T += T2_offset;
> 			T *= T2_scale;
> 			return (T);
> 		}
> 		T = read_AI1();
> 		if (T > 50 && T < 975) {
> 			T += T1_offset;
> 			T *= T1_scale;
> 			return (T);
> 		}
> 		T = read_AI0();
> 		if (T > 50 && T < 975) {
> 			T += T0_offset;
> 			T *= T0_scale;
> 			return (T);
> 		}
> 		abort("You have problems...");
> 	}
>


More information about the time-nuts mailing list