Many times it is necessary to switch the gain of an operational amplifier, transforming an inverting stage to non-inverting or the other way around.
This is useful in front-ends, analog signal conditioning, modulators, choppers and almost mandatory in audio systems, where signal phase inversion can be requested by the user in a per-channel basis.
In mixed signal domain systems, tri-state CMOS stages can be used as the gain switch. When design in pure discrete analog, JFET are the preferred choice for the job, as we will see.
The gain is switched by redirecting the signals around the amplifier, changing the closed-loop behavior of the feedback.
For operation as an inverting stage, the virtual ground topology is commonly used. In this configuration, the positive input of the amplifier is tied directly to ground. Feedback action will ensure 0V at the negative input and, as a consequence, the output voltage will always swing to the opposite side.
If the positive input ground connection is opened and a copy of the input signal applied there, the gain will be changed to positive. Now, as the positive input sees the input signal, the opamp swings the output to the same direction as the input, to ensure negative and positive inputs equality.
Using a JFET transistor as an on-off switch, the transition between configurations can be accomplished. The positive input sees the input signal through a resistor, and the transistor is used to ground the positive input when negative gain is needed.
The transistor can be turned-on and off applying a negative voltage at is gate. When the gate is at 0V the JFET channel will have it's lower possible resistance, virtually grounding the positive input, as the signal is sourced by the resistor.
A negative voltage at the gate will bring the channel to pinch off, disconnecting the ground, allowing the opamp to operate in the positive gain mode.
As the JFET channel resistance is continuously modulated by the gate voltage, the opamp gain also will change smoothly as the voltage is changed. This allows operation as analog gain controller in AGCs and ALCs (Automatic Gain Controller and Automatic Level Controller).
In this YouTube Video I showed how the circuit can be used as a modulator or chopper, using a modulating signal at the JFET gate. It is important to note that the output transition swing will be limited by the opamp slew-rate.