1.8 CDAC Waveform Generation
This example application shows how to use the CDAC to generate a 1 kHz sinusoidal waveform.
Description
The CDAC Peripheral library is used to generate a Sine wave. The TMR1 peripheral is configured to trigger CDAC every ten microseconds. In this application, the number of DAC samples per cycle (0 to 360 degrees sine wave) is 100.
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/cdac/cdac_wav_gen/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32mk_mcj_curiosity_pro.X | MPLABX project for PIC32MK MCJ Curiosity Pro Board |
pic32mk_mca_curiosity_pro.X | MPLABX project for PIC32MK MCA Curiosity Pro Board |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32mk_mcj_curiosity_pro.X | PIC32MK MCJ Curiosity Pro Board |
pic32mk_mca_curiosity_pro.X | PIC32MK MCA Curiosity Pro Board |
Setting Up PIC32MK MCJ Curiosity Pro Board
- Connect an oscilloscope to monitor the DAC1 (RC10) pin (Pin 16 of J601)
- Connect the Debug USB port on the board to the computer using a micro USB cable
Setting Up PIC32MK MCA Curiosity Pro Board
- Connect an oscilloscope to monitor the DAC1 (RA8) pin (Pin 16 of J601)
- Connect the Debug USB port on the board to the computer using a micro USB cable
Running the Application
- Build and Program the application using its IDE
- Observe a sine wave of 1 kHz frequency on DAC1 output pin