PIC24 Support Libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pwm_dac_test.c File Reference
#include "pic24_all.h"
#include <stdio.h>

Go to the source code of this file.

Detailed Description

Demonstrates a PWM DAC - connect an RC filter on the OC1 output and vary the pulse width of the PWM signal, and monitor the DC value on the capacitor. The RC time constant should be at least 10x greater than the PWM period. Example values used for testing were R=6.8k, C = 1.0u, PWM period= 500 us. Measured ripple was 80 mv, time for the DAC to change voltage from 1.0 V to 3.0 V and vice versa was ~ 30 ms (about 60 PWM periods) For more accuracy, use an external crystal and define CLOCK_CONFIG=PRIPLL_8MHzCrystal_40MHzFCY in the MPLAB project. Remove this macro if you wish to use the internal oscillator.

Definition in file pwm_dac_test.c.