1.8 DACC Waveform Generation with DMA
This example shows how to use the DAC with the DMA to generate sinusoidal waveform without CPU intervention.
Description
The DACC Peripheral library is used in hardware trigger mode to generate a Sine wave. On every Timer Counter (TC) Interrupt, the DACC converts the digital data to analog data by reading it from memory using XDMAC.
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. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/dacc/dacc_wav_gen_dma/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32cz_ca70_curiosity_ultra.X | MPLABX project for PIC32CZ CA70 Curiosity Ultra Development Kit |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32cz_ca70_curiosity_ultra.X | PIC32CZ CA70 Curiosity Ultra Development Kit |
Setting Up PIC32CZ CA70 Ultra Curiosity Development Kit
- Connect the DACC "Channel 0" to oscilloscope probe for observing the analog
output waveform
- DACC Channel 0 is available through PB13 (Pin 8 of the EXT2 header)
- Connect 3.3V from pin 4 of J401 to VREFIN pin on J302. This generates 2.048V reference voltage (VREFP) for the DAC.
- Connect GND from pin 6 of J401 to GND pin on J302.
Running the Application
- Build and Program the application using its IDE
- Observe a sine wave on DACC output pin
Board DACC Output Pin PIC32CZ CA70 Curiosity Ultra Development Kit PB13 (Pin 8 of the EXT2 header)