6.2 Configure OP0 as a Non-Inverting PGA Using Atmel START
Todo:
- Edit the Atmel START project, so OP0 is configured as a non-inverting PGA
- Plot the input and output of OP0 in the MPLAB® Data Visualizer
- Press the Reconfigure Atmel Start Project button marked with a red circle in Figure 1 to reconfigure the project.
- Press the Add software component button, search for op amp, press the plus button and the Add component(s) to add the op amp driver to the project.
- Press the OPERATIONAL_AMPLIFIER_0 to be able to configure the OPAMP peripheral.
- Make sure the COMPONENT SETTINGS
and CLOCK is as shown in Figure 2.Info: The Select OPAMP combination determines if the op amps are configured individually or combined to create multi op amp configurations. Not every configuration is available for every combination of op amps. See the START driver user guide for an overview. It is also provided below.
- Make sure that OP0 is enabled by checking the OP-AMP0 CONFIGURATION Enable. Checkmark and configure the op amp as a non-inverting PGA by selecting Non-Inverting PGA in the Single OPAMP Application (OP0) drop-down menu as shown in Figure 4.
- Set the OPAMP0 SETTINGS, as shown
in Figure 5.
This will set the DAC as an input to the op amp, and the non-inverting PGA will
have a gain of 2.Info: The grayed out options are options that cannot change as that will break the chosen configurations, but they are still visible to inform the user what kind of settings are needed for the configuration.
- Set the HARDWARE SETTINGS to what is shown in Figure 6. It should be the default values.
- Press GENERATE PROJECT to
regenerate the start project with the newly added op amp settings. Warning: There will pop up a window called Project Summary shown in Figure 7. Press okay and do not check the checkmark next to main.c. If this is done, the project custom changes in main.c will be overwritten and lost, and the project will not work.
- Verify that the solution/project builds by selecting the Build → Build Solution from the top menu bare in Atmel Studio or by pressing the F7 key.
- Flash the device by selecting the Debug → Start without debugging from the top menu bar in Atmel Studio or by pressing the Ctrl+Alt+F5 keys.
- Plot the DAC output vs. the op
amp output using the MPLAB® Data Visualizer by loading the workspace
Assignment4.json.Info: The DAC outputs a 50 Hz sinusoidal wave with 128 mVpp and a DC offset of 128 mV.
Result: The
plot in the MPLAB® Data Visualizer should look similar to the one in Figure 8. The red
waveform is the output from the DAC, while the green is the output from the op amp.
As expected, the output from the op amp is two times as large as the output from the
DAC. This also matches what we saw in the simulations earlier in the assignment.