I am using Pic18f452. I have to compare two reading of voltage. i used the op-amp 741 in such a configuration. I am obtaining the feedback voltage form boost converter output capacitor.enter image description here The schematic is attached here. I am using this in hardware. just suppose the voltage 4.5v and 4.1V that will be compared to the Boost capacitor output voltage which varies form 0v to 5v.

Now the problem is that when the Boost capacitor output voltage goes just above to 4.1V the output of op-amp 2 goes to 0v which is right . similarly , when the boost capacitor output voltage goes above to 4.5v OPAMP1 is turn on. Boost PWM is turn off bu PIc18f452 and the converter start in buck mode.
the output voltage of boost capacitor goes down but now the PIC didnt start the boost when the op-amp agian goes to zero.. it must have to start the Boost PWM. can you tell me what will the problem with PIC or Op-amp in compared mode.

  • 1
    \$\begingroup\$ In addition to the unsuitability of a 741 in your circuit, have you considered just using a PIC with comparators built-in? \$\endgroup\$
    – brhans
    Aug 16, 2016 at 13:48
  • 1
    \$\begingroup\$ 741's are the slim in the ocean at the beginning of life... get some thing less then 40 years old. These beasts need minimum 10V (+/- 5V rails to even start working!) and then 2V clearance from each rail get's you to just about working. see ti.com/lit/ds/symlink/lm741.pdf for a slightly updated version.... minimum rails are +/- 10V ... \$\endgroup\$
    – Spoon
    Aug 16, 2016 at 13:50
  • \$\begingroup\$ See also this post from Marla \$\endgroup\$
    – JRE
    Aug 16, 2016 at 14:18
  • 2
    \$\begingroup\$ Your nodes marked 4.1V and 4.5V are both fed by a symmetrical voltager divider and should both be 2.5V. Either your voltages are wrong, or your resistor values are. Please fix your schematic. \$\endgroup\$
    – marcelm
    Aug 16, 2016 at 14:27
  • 3
    \$\begingroup\$ Apart from issues of age and general suitability, you MUST learn to read datasheets to determine how a component can and/or must be used. An understanding look at the LM741 datasheet wou;d show you that this circuit cannot operate. If you cannot understand that from the datasheet then you urgently need to learn more in that area. \$\endgroup\$
    – Russell McMahon
    Aug 16, 2016 at 14:49

2 Answers 2


If you want to use a cheap ancient part that actually will function on 0/5V, the LM393 is certainly a usable dual comparator. The 741 will not operate from +5V . Don't forget the output pullup if you use it. See below for comments on the input common-mode range.

It's inadvisable to use op-amps as comparators anyway unless you really analyze the situation- some of them behave very badly when (significant) differential voltage is applied. Another problem is that they're not designed to be saturated and have compensation for stability in op-amp use- recovery may take a very long time- 50usec or more in some cases. Also the output may not be compatible with logic (eg. the 741). And their output slew rate is glacial compared to a comparator.

There is another problem however- the input common mode range of the LM393 extends only to 3V or 3.5V with a 5V supply. While you could source a device that is rail-to-rail input, it would be a better solution to divide down the input voltage to (say) half so your comparison takes place near 2.5V. This would allow many more options such as the antediluvian LM393, which is multi-sourced as well as being inexpensive- a true jellybean part.

By the way, if you do this, an updated model to the PIC you are using (PIC18F4520) has an internal comparator module that is similar in performance to the LM393 with a similar common mode range (Vdd-1.5V), so you may not need any external parts at all.. as a bonus, it's considerably cheaper.

enter image description here


741's are not suitable for use with 5V power supplies, and will not handle inputs and outputs that are close to the power supply rails. You need an op-amp with rail-rail inputs and outputs and suitable for a 5V supply to use in this type of circuit

  • \$\begingroup\$ Thank you So much Sir@Icy .. Can you tell me the exact Number of rail-to -rail Op-amp... I am very tahnkfull to you \$\endgroup\$
    – Misal313
    Aug 16, 2016 at 14:00
  • \$\begingroup\$ There are lots: eg OPA341, TLV2462, LTC1152 also see here: electronics.stackexchange.com/questions/121552/… \$\endgroup\$
    – Icy
    Aug 16, 2016 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.