Example Overview

In the application example, OPAMP2 is configured as a non-inverting PGA. The amplified output is enabled for sampling with ADC. As can be seen in the datasheet, the OPAMP2 positive input can be multiplexed to I/O pin PA05, hence the input signal to be amplified must be connected to this pin. The pin must also be configured as an input. The ADC needs to be configured in order to use the OPAMP2 output as input.

Figure 1. OPAMP2 Configured as Non-inverting PGA with Output Connected to the ADC Module

In this example OPAMP2 is configured with R2/R1 = 1/3 and the internal connection to the ADC is enabled. When OPAMP2 is configured and enabled in the main loop, the ADC starts converting a predefined number of samples of the amplified signal. The ADC is configured in callback mode, implying that an interrupt occurs when the conversion is complete.