Categories

App note: Op-amp/comparator module for dsPIC

Posted on Sunday, January 1st, 2012 in app notes by DP

Some dsPIC33E and PIC24E microcontrollers have an comparator module that can function as an op-amp [PDF]. The module can be used as a simple non-inverting amplifier by adding two external resistors, no external op-amp chip needed. The output can be read internally by the ADC module, or routed externally to use in your circuit.

This entry was posted on Sunday, January 1st, 2012 at 9:00 pm and is filed under app notes. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

9 Responses to “App note: Op-amp/comparator module for dsPIC”

  1. DwayneR says:

    Note: the op-amp can be configured as an INVERTING amplifier, NOT non-inverting.

    Note that it does make a pretty darned awful op-amp – but sometimes that’s all you need.

    dwayne

    • rsdio says:

      Why? All 3 op-amp connections are available, so non-inverting configurations should work equally well. i.e. CxIN1+ is an external pin and can be connected to something besides ground if needed, such as Vin. In that case, R1 would be grounded where it connects to Vin in the inverting configuration.

      If I’m missing something, then please explain.

      Did you mean to say that the comparator output cannot be inverted if you want the op-amp to function?

      • DwayneR says:

        [quote] Why? All 3 op-amp connections are available [/quote]

        Yeah – you are correct. I was paying more attention to the circuit as drawn which, of course, is an inverting amplifier.

        dwayne

  2. Philip says:

    Hi Guys!

    If its a comparator it means that it does not have compensation[compensationcap] – which means this could affect its performance in high frequencies? This is a question..what are your views on it?

    • rsdio says:

      Single op-amps sometimes have compensation capacitors, but quad op-amps never do. If quad op-amps can work just fine without compensation then it seems these dsPIC op-amps can do at least as well.

  3. ultrasoundero says:

    @Philip. You are spot on. Comparators are not optimized for closed loop operation though you could always use one. People often get away by using one of the un-used comparators in a quad package as a cheap-ass opamp. So, a comparator when operated in closed loop has very low gain band-width and lack of internal miller compensation means a tendency to oscillate. A comparator also drives its output to logic levels as against an OpAmp. I personally always steer away from using a comparator as an OpAmp. I have to read the datasheet to understand the actual implementation details.

  4. Pepijntje says:

    Back to the basics : the main difference between an Opamp and a Comparator is the internal Miller compensating capacitor (to guarantee phase margin in the loop). The Opamp has it, the Comparator has not. Feedback requires the Miller else you will have a nice oscillator. But Miller makes your circuit slow. Opamp speed is microseconds, Comparator speed is nanoseconds.
    An Opamp can be used as a (slow) Comparator.
    A comparator cannot be used as an Opamp, unless you add a quite large external capacitor in your feedback loop.
    Single or dual or quad versions are irrelevant to the above.

  5. Martin Hoppe says:

    Hi,

    I´m trying something very similar to the schematic above. I want to connect the output of the OPAMP of a PIC24F16KM204 internally to the AD-Converter. But the datasheet of the Pic-Opamp-Datasheet refers to the Pic-ADC-Datasheet and this one doesn´t give the option OAOUT as an internal input.
    Am I doing something wrong? What am I missing? Would be cool if someone has an idea!

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • burkm m: It drifting even further using that standard XO...
  • langwadt: a HC14 is a bad choice for an xtal oscillator, the unbuffered non-Schmitt trigger HCU04 is much better for that application
  • Bill F: I'm ready for one!
  • Wynand Pretorius: This is so cool!
  • James Willey: free pcb!!!