Author Topic: Comparator and MCU as an Opamp  (Read 1335 times)

0 Members and 1 Guest are viewing this topic.

Offline MechatrommerTopic starter

  • Super Contributor
  • ***
  • Posts: 11622
  • Country: my
  • reassessing directives...
Comparator and MCU as an Opamp
« on: July 11, 2016, 05:46:59 pm »
thinking about it its rational, but it just came to me when i was simulating my preregulator circuit using a comparator as so called "novel" SMPS PWM generator, because i trust a comparator somewhat like a logic circuit only producing HI or LO output. but then due to unbehaviour of my simulation (my supposedly SMPS circuit went into linear mode and the mosfet is going to burn like fire) tracing my circuit, i realized the comparator setup is just as similar as a gain opamp and hence went to a stable mid voltage output in the rail, how can this be? its a blasphemy! now i'm adding logic circuit upfront the comparator so i can further ensure only HI or LO is produced, is this a rational move? i dont know, the Tina simulator doesnt have logic part to simulate with.

and then googling "comparator as an opamp" gives very very few result, 1 in a million maybe, the rest of 999999 are talking about "opamp as comparator" the vice versa. but one thing special about this 1 link, is the text is talking about using an MCU comparator as a gain voltage opamp, this is just  :scared: but reading it its typical using RC filter. but then, unlike MCU's comparator (which can produce only HIGH or LOW, through digital flip flop), analog comparator like 393 is subjected to the opamp behaviour without even the need of RC filter. maybe this MCU opamp setup can be applicable to my next project, just saying.

http://electronicdesign.com/analog/get-extra-op-amps-using-spare-comparators
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Comparator and MCU as an Opamp
« Reply #1 on: July 11, 2016, 11:49:56 pm »
thinking about it its rational, but it just came to me when i was simulating my preregulator circuit using a comparator as so called "novel" SMPS PWM generator, because i trust a comparator somewhat like a logic circuit only producing HI or LO output. but then due to unbehaviour of my simulation (my supposedly SMPS circuit went into linear mode and the mosfet is going to burn like fire) tracing my circuit, i realized the comparator setup is just as similar as a gain opamp and hence went to a stable mid voltage output in the rail, how can this be? its a blasphemy! now i'm adding logic circuit upfront the comparator so i can further ensure only HI or LO is produced, is this a rational move? i dont know, the Tina simulator doesnt have logic part to simulate with.

and then googling "comparator as an opamp" gives very very few result, 1 in a million maybe, the rest of 999999 are talking about "opamp as comparator" the vice versa. but one thing special about this 1 link, is the text is talking about using an MCU comparator as a gain voltage opamp, this is just  :scared: but reading it its typical using RC filter. but then, unlike MCU's comparator (which can produce only HIGH or LOW, through digital flip flop), analog comparator like 393 is subjected to the opamp behaviour without even the need of RC filter. maybe this MCU opamp setup can be applicable to my next project, just saying.

http://electronicdesign.com/analog/get-extra-op-amps-using-spare-comparators

Hi

Most comparators have really awful phase response. If you put them in the linear region, they oscillate. Many MCU comparators have a finite amount of hysteresis built in to tame them that makes them really poor op-amps.

Bob
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: Comparator and MCU as an Opamp
« Reply #2 on: July 12, 2016, 12:23:42 am »
The basic idea is to wire the comparator with feedback into a capacitor to generate a PWM then low-pass filter that.  The result is a very crappy OPAMP.
Prior art: TIP #12 in Microchip's PICmicro Comparator Tips ‘n Tricks, 2003.
As the Microchip example didn't have any explanation, I would assume it was regarded as obvious or a common technique so it probably goes back a lot earlier than that.  It may even originate from electromechanical regulator systems predating the transistor.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Comparator and MCU as an Opamp
« Reply #3 on: July 12, 2016, 05:17:18 am »
Take a look at the design of switching regulators like the popular mc34063 which use pulse frequency modulation.  They place a set/reset flip-flop at the output of the comparator so the clock provides a constant off time.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf