1.7 DACC Waveform Generation
This example shows how to use the DACC peripheral to generate a 5 kHz sine wave or triangle wave using a look up table.
Description
The DACC Peripheral library is used to generate either sine wave or triangle wave, by writing digital data to the DACC in periodic callback on every Timer Counter (TC) Interrupt.
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/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 respective IDE
- Observe a sine wave of 5 kHz frequency on DACC output pins
- Press switch SW0 to toggle the waveform shape from sine wave to triangle wave
and back
Board DACC Output Pins PIC32CZ CA70 Curiosity Ultra Development Kit PB13 (Pin 8 of EXT2 Header)