3 Sine Waveform Generation with Variable Frequency 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 DAC peripheral is used to output a sine waveform with variable frequency controlled by the value measured with the ADC peripheral from a potentiometer. The TMR0 module is used as auto-conversion trigger source for the ADC peripheral while the TMR1 module’s overflow interrupt is used to alter the output of the DAC peripheral. The ADC peripheral’s conversion-complete interrupt is used to modify the overflow period of TMR1 module. The APM periodically enables the ADC and DAC to perform conversions and output the sine waveform respectively.