PWM Generator Using ADC

PWM Generator Using ADC

Pulse-based Control Application

PWM generators can be used to control devices such as dc motors and LEDs. This implementation uses an analog signal connected to an ADC to compare with the value of CNT2 in PWM0. If the CNT2 value is less than the digitized analog signal the output of PWM0 is high. After CNT2 value is 0 the output of PWM0 is low.

 

Ingredients

  • GreenPAK with ADC
  • No other components are needed

GreenPAK Diagram

Design Steps

  1. Remove VDD from the ADC’s PWR DOWN input and set PGA power on signal to Power on.
  2. Set PIN 6 to Analog input/output.
  3. Configure DCMP0/PWM0 by deleting VDD from SHARED PD input. DCMP/PWM power register set Power on. Check that IN+ selector connect to ADC and IN- selector connect to FSM0.
  4. Configure 4-bit LUT1/14-bit CNT2/DLY2/FSM0 as Counter/FSM with counter data equal to 255.
  5. Connect DCMP0/PWM0 OUT+ to output pin.

Resources

GreenPAK Designer files