Jump to main content

##

# 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
--- | ---
sam_e70_xult.X | MPLABX project for SAM E70 Xplained Ultra Evaluation Kit
sam_v71_xult.X | MPLABX project for SAM V71 Xplained Ultra Evaluation Kit

## Setting Up the Hardware

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

Project Name | Description
--- | ---
sam_e70_xult.X | SAM E70 Xplained Ultra Evaluation Kit
sam_v71_xult.X | SAM V71 Xplained Ultra Evaluation Kit

### Setting Up SAM E70 Xplained Ultra Evaluation Kit

- Connect the DACC “Channel 0” and “Channel 1” to oscilloscope probe for observing the analog output waveform
  - DACC Channel 0 is available through PB13 (Pin 5 of the J502 connector)
  - DACC Channel 1 is available through PD00 (Pin 6 of J502 connector)
- PD00 line is connected to the external oscillator on the board to act as Ethernet Clock and it needs to be disabled to observe the DACC Channel 1 output
  - Short the Jumper (J805) located near the Ethernet PHY interface to Disable the Oscillator
- Connect the Debug USB port on the board to the computer using a micro USB cable

### Setting Up SAM V71 Xplained Ultra Evaluation Kit

- Connect the DACC “Channel 0” and “Channel 1” output pin to oscilloscope probe for observing the analog output waveform
  - DACC Channel 0 is available through PB13 (Pin 5 of the J504 connector)
  - DACC Channel 1 is available through PD00 (Pin 6 of J504 connector)
- Connect the Debug USB port on the board to the computer using a micro USB 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 pins
3. Press switch SW0 to toggle the waveform shape from sine wave to triangle wave and back

   Board | DACC Output Pins
   --- | ---
   SAM E70 Xplained Ultra Evaluation Kit | PB13 (Pin 5 of J502 connector) PD00 (Pin 6 of J502 connector)
   SAM V71 Xplained Ultra Evaluation Kit | PB13 (Pin 5 of J504 connector) PD00 (Pin 6 of J504 connector)