Re: Something to ponder

From: Ken Smith (kensmith_at_green.rahul.net)
Date: 10/03/04


Date: Sun, 3 Oct 2004 16:47:01 +0000 (UTC)

In article <fgvul0l3odaa0ndgi2duqhb5i2j6omlojk@4ax.com>,
nospam <nospam@nospam.invalid> wrote:

[... me ...]
>> 65536 * Vin / (2 * Vref)
>>
>>
>>You can make the main loop of the code do it.
>
>This is a crude (or elegant depending on how you look at it) delta sigma
>converter. Your maths isn't right.

I think my math may be better than my typing in this case. But it was a
good catch on your part and yes it isn't very linear. I was using Vref=5V
and the input as about 10V as the point that mattered.

As for this being crude (or elegant), I take it more as "good enough". In
the cases I used it, I was checking the battery voltage. I just needed to
know the voltage of the lead acid is above 10.5V and give a little warning
as it went down. For that it was good enough.

I'm making a slight change to your design below:
>If you did this
>
>
> KR
> Vin -/\/\/\------
> !
> R ! ! \
> ----/\/\/\---------------!+ \
> ! ! ! ------- TooHi to CPU
> !!- ---C ---!- /
> Ton ----!! --- ! ! /
> !!- ! !
> ! ! REF
> GND GND
>

With the change I made, the circuit is now good for from Vref to
(K+1)Vref. If I'd though of your circuit with this change, it is likely I
would have done this instead. Adjusting K to get the top of the span 15V
and using the +5V supply as Vref, it would work quite a bit better. Not
that better was really needed in my case.

>With either circuit you should also note that the loop execution time must
>be constant although a bit of jitter which is not dependant on the state of
>TooHi would average out I suppose.

Even if the state of TooHi changes the loop time a little, you can correct
for this in the scaling so no-one notices.

I my case, the loop went around 176.00 times per second.

>I would be suprised if this isn't in a PIC application note somewhere.
>Don't some PICs have a reference, comparator and open drain output?

Others have an ADC so maybe they don't suggest ways to not use the ADC.

-- 
--
kensmith@rahul.net   forging knowledge


Relevant Pages

  • Re: more curved icicles
    ... I'm simulating a digital control loop, essentially a constant-voltage ... There are two ADC ... The output voltage is picked up by a diffamp and fed to ...
    (sci.electronics.design)
  • Re: Taking data out of an file
    ... open "NewFile" for output as 2 ... Of course that's very crude, but it shows the general idea. ... Jim Mack ...
    (microsoft.public.vb.syntax)
  • Re: Examples of Anti-Anti-Alias Requirements
    ... The conservative rule for the stability would be having a unity loop gain at 1/. ... ADC creates a delay as long as 10...20 periods of the output sample rate. ... "The rights of the best of men are secured only as the ...
    (comp.dsp)
  • Re: pushf v rcl, save, restore carry flag
    ... through each pair of 64 bit longs and adc them. ... flag, as, my loop counter sets it too. ... implement that sort of loop without stomping on the carry flag. ... OTOH, this sort of optimization always needs to be tested, it's far to ...
    (alt.lang.asm)
  • Re: Fastest way to run a software feedback loop?
    ... chip that can sample its ADC at 400kHz, and manages at least one MIP/MHz, ... then you should be able to close a loop at 400kHz if it's hand-written in ... i do and i have done a 125KHz A2D data capture with PIC24F. ...
    (sci.electronics.design)