1.7 CMP DAC Sine Wave
This code example demonstrates how to generate a 100 Hz sine wave without CPU intervention using the DMA, DAC and TMR peripherals.
Description
The DMA peripheral will utilize the timeout event generated by the TMR1 module to iterate and place values from a 256 point sine lookup table to a DAC peripheral for output.

Downloading and Building the Application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file.
Path of the application within the repository is apps/cmp_dac/master/cmp_dac_sine_wave/.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32ak_gc_curiosity.X | MPLABX project for Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM) |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32ak_gc_curiosity.X | Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM) |
Setting Up Curiosity Development Board
- To run the application,
following additional hardware are required:
- Oscilloscope or probe to view the sine wave output.
- Insert the GP DIM on to DIM slot of Curiosity Board
- Connect the PKoB (J21) on the board to the computer using a USB type-C cable
- Connect the oscilloscope probe to P51 (RA1/DACOUT1)
Running the Application
- Build and program the application
using its IDE:
- 100 Hz Sine Wave is
observed on the oscilloscope
- 100 Hz Sine Wave is
observed on the oscilloscope
Time Period | Frequency |
---|---|
3906 us | 1 Hz |
3.906 us | 1 kHz |
0.3906 us | 10 kHz |
Board | DACOUT Pin Name |
---|---|
Curiosity Platform Development Board and PIC32AK1216GC41064 General Purpose Dual In-Line Module (DIM) | P51 (RA1) |