4 Triangle Waveform Generation with Variable Amplitude Using ADC, DAC and APM

The following use case was designed to highlight the capabilities of the APM as well as to showcase its configuration in MCC Melody. The FVR peripheral is used to provide fixed voltage references of 2.048 V and 4.096 V to the ADC and DAC peripherals respectively. The DAC peripheral is used to output a triangle waveform with variable amplitude controlled by the value measured with the ADC from a potentiometer. The APM is configured as the auto-conversion trigger source for the ADC, and the TMR1 module’s overflow interrupt is used to alter the output of the DAC. The ADC peripheral’s conversion-complete interrupt is used to modify the amplitude of the triangle waveform. The APM periodically enables the FVR to set the voltage references, the ADC to perform a single conversion and the DAC to output the triangle waveform.

Note: To obtain the fixed voltage reference of 4.096 V for the DAC peripheral it is necessary to perform hardware changes to the Curiosity Nano Adapter board; otherwise, the output of the DAC will be limited to 3.3 V. For detailed information on how to perform these changes, refer to section 3.2. Power Supply of the Curiosity Nano Base for Click boards™ Hardware User Guide (DS5002839).