1.6 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
sam_rh707_ek.XMPLABX project for SAM RH707F18 Evaluation Kit

Setting Up the Hardware

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

Project NameDescription
sam_rh707_ek.XSAM RH707F18 Evaluation Kit

Setting Up SAM RH707F18 Evaluation Kit

  • Connect the DACC “Channel 0” output pin to oscilloscope probe for observing the analog output waveform
    • DACC Channel 0 is available through DAC0 SMB connector
  • Connect the debugger probe to J5 connector
  • Connect the J1 (USB-C) port on the board to the computer using a USB-C cable

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 pin
  3. Press switch PB0 to toggle the waveform shape from sine wave to triangle wave and back
    BoardDACC Output Pins
    SAM RH707F18 Evaluation KitDAC0 SMB connector