This quick note is less for design in an MSP430 circuit, but a quick tutorial on Op-Amps that will help those less familiar with electronic components to understand the next tutorial.
The Operational Amplifier, or Op-Amp is an extremely useful piece of hardware. (Some MSP430 devices come with Op-Amp peripherals built in!) The name reflects two very important functions of the device; it can be used to effect the equivalent of a mathematical operation to one or more electrical signals, or it can be used to amplify a signal.
While the details of how an op-amp works physically are a little complicated, visualizing what happens from a practical viewpoint is not so difficult. There are two inputs, labeled V+ and V- in the above schematic. The + and - labels next to the V+ and V- pins help you remember which pin is which. While both are inputs, they don't necessarily behave the same way, which gives the op-amp some of its flexibility. There is one output (Vout). Vs+ and Vs- are the positive and negative sides of a power supply. (Note that Vs- does not necessarily have to be a negative value--some circuit designs use ground on this pin.)
When you analyze an op-amp design, the simplest way to view the chip is to recognize that the output will be an amplification of the potential difference between the V+ and V- pins. Usually the gain on an op-amp is very high (1-10s of thousands) and so a very small difference can be enough to drive the output all the way up to Vs+ (if V+ > V-) or down to Vs- (if V+ < V-). (This is the behavior of what's called a differential amplifier.)
Since the gain is so high, we can use the op-amp in this configuration to compare two voltages. If voltage 1 on V+ is greater than voltage 2 on V-, we get a high output from the op-amp. If we have the reverse situation, we get a low output from the op-amp. In reality, general purpose op-amps are not the best choices to make this comparison, so a special chip called a comparator was designed to do this job. We'll examine it more closely in the coming tutorial.
The true power of the op-amp comes in the ability to tie the output to one of the inputs, providing a feedback that drives the output one direction or another. With feedback in place, the output will change until one of three conditions is reached: the output has increased to Vs+ and cannot increase further, the output has decreased to Vs- and cannot decrease further, or the output has found a state where the two inputs are the same potential. Whenever feedback is used, the output will drive up or down seeking to make the potential difference on the inputs zero.
Op-amps are a very important component for electronic designs. If you're not familiar with them, I'd highly recommend doing some reading to understand them better. (See for example the page on Wikipedia.) My purpose in this note was to mention the comparison operation so that readers have at least been introduced to the comparator before I write up the next tutorial.
This post was prepared while in Andenes, Norway.