cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Comparator

thorsten2
Associate II
Posted on January 02, 2010 at 13:52

Analog Comparator

5 REPLIES 5
thorsten2
Associate II
Posted on May 17, 2011 at 13:34

Hi,

is there an analog comparator in the stm32f103?

I can't find one ...

What is the best way to compare two ADC and get an interrupt?

Thanks!

Regards,

Thorsten

akaiser9
Associate II
Posted on May 17, 2011 at 13:34

A comparator IC and a pin configured for interrupt. Or the ADC configured for measurement of those 2 values and a compare operation in the ADC interrupt.

[ This message was edited by: prx on 15-12-2009 18:22 ]

thorsten2
Associate II
Posted on May 17, 2011 at 13:34

I think the analog Watchdog is a good solution.

Is it posible to configure 4 watchdogs? In the samples I found the posibility to configure the channel or all channels and one max/min value.

But I need to check 4 ADC lines with other 4 lines with different min/max values?

Is this possible?

If not I think an interrupt after adc conversion and check the values by code is the best solution.

Regards,

Thorsten

jj
Associate II
Posted on May 17, 2011 at 13:34

As you seek to compare 4 channels - prx's suggestion of analog comparator IC ''jumps out.'' (many are 4 ch. in single pck)

Sometimes - temptation to ''do everything'' via MCU must be traded against the ease & much faster response of a dedicated, content-specific IC.

picguy
Associate II
Posted on May 17, 2011 at 13:34

thorsten.raab,

How fast do you need it to be?

If it’s in the 1 to 2 microsecond range you need dedicated hardware.

If you can live with 5 microseconds then ADC/DMA/ISR when all 4 are done. With a 72 MHz processor this is 4.68 microseconds for 4 conversions. Take any needed action in your ISR and restart your 8 conversions. Faster than you want? Use a timer to trigger ADC start.

You can do this without using interrupts if you are able to look often enough. Use ADC/DMA in continuous mode. Use a timer to start the next conversion every 1.2 microseconds. Conversions run forever without further intervention. Look at your results any time.

With 4 channels you can use the injected channels without DMA. Test carefully. It’s easy to get the channel results backwards.