There are two methods of using a DAC on a CY8C21x34:
- Add a comparator and select for reference input the ASE10 or ASE11 source. Start it with Full power.
- Add an counter as PWM generator, select row broadcast bus source the counter block. Start it.
- Write to AMD_CR0 by selection modulator source the boardcast bus.
- Clear ADCx_TR register to set maximum capacitor array values.
- Clear FVal bit in ASExxCR0 register.
Note: This analog output can only be used internally for example as a Reference to a comparator input.
For more details have a look at the example project attached here.
Route the PWM output to a GPIO pin, pass the PWM output through a low pass filter such that the cut off frequency is lower than the PWM frequency. The analog output level is varied by changing the duty cycle of the PWM. For 90% duty cycle of PWM, you get an analog signal of 4.5V and for 10% duty cycle of PWM, you get an analog signal of 0.5V.
Note: This method requires external components but the analog output can be used externally.