Plot a graph of measurements without using
the PGA
Configure the ADC to use the PGA to amplify
the signal
Plot a graph of measurements with the
amplified signal
Verify that the solution builds with no
errors by selecting Build → Build Solution from the top menu bar
in Microchip Studio or pressing the F7 key.
Flash the device by selecting Debug →
Start without debugging for the top menu bar in Microchip Studio or
pressing the Ctrl+Alt+F5 keys.
Info: Configure the project to
do periodic burst measurements using the RTC and event system as in
assignment 2.
Load the workspace Assignment6.json in
the MPLAB Data Visualizer.
Press the force sensor as hard as possible
and observe the graph in the MPLAB Data Visualizer.
Result: The plot should look similar
to Figure 1, where the top value is around 1k. The value is expected
to be around 1k, as the voltage divider divides the voltage by 4, and
VCC is represented in the ADC by 4095. Figure 7-3. Assignment 6: No
Amplification
Configure the PGA to amplify the signal by
4x, have a bias current of 50%, a sampling duration of 15 clock cycles, and
enable the PGA by writing the following in
adc.c:
Info: The PGABIASSEL determines how much current the PGA uses.
How much current the PGA needs depends on the ADC clock frequency. See
the PGA Control (PGACTRL) register description in the device data sheet for
info about how much current the PGA needs.
Info: When using
the PGA, the SAMPDUR determines the input sample duration,
while ADCPGASAMPDUR determines for how long the ADC samples
the PGA.
Connect the input via the PGA by
writing:
ADC0.MUXPOS = ADC_MUXPOS_AIN6_gc | ADC_VIA_PGA_gc; /*ADC channel AIN6->PA6, input connected to the ADC via PGA*/
Info: The VIA bits in MUXPOS and MUXNEG are shared, so a value written to the VIA
bit field in one of the two registers is updated in both. Therefore, it is impossible to have one input using the PGA and the other not using the
PGA.
Verify that the solution builds with no
errors by selecting Build → Build Solution from the top menu bar
in Microchip Studio or pressing the F7 key.
Flash the device by selecting Debug →
Start without debugging for the top menu bar in Microchip Studio or
pressing the Ctrl+Alt+F5 keys.
Press the force sensor and observe the plot
in the MPLAB Data Visualizer.
Result: The result
should look similar to Figure 2, where the top value is about 4k.Figure 7-4. Assignment 6: Amplified
Signal
The online versions of the documents are provided as a courtesy. Verify all content and data in the device’s PDF documentation found on the device product page.