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 NameDescription
pic32cz_ca70_curiosity_ultra.XMPLABX project for PIC32CZ CA70 Curiosity Ultra Development Kit

Setting Up the Hardware

The following table shows the target hardware for the application projects.

Project NameDescription
pic32cz_ca70_curiosity_ultra.XPIC32CZ 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

  1. Build and Program the application using its respective IDE
  2. Observe a sine wave of 5 kHz frequency on DACC output pins
  3. Press switch SW0 to toggle the waveform shape from sine wave to triangle wave and back
    BoardDACC Output Pins
    PIC32CZ CA70 Curiosity Ultra Development Kit

    PB13 (Pin 8 of EXT2 Header)