P1 software PASM DAC
pic18f2550
Posts: 400
Hello,
I'm looking for a DAC PASM software solution for the P1.
I only found ADC (PASM) and PWM (SPIN).
Comments
Hi,
Pwm plus a RC Filter does the trick.
Filtered PDM (duty-cycle counter mode) is far better than filtered PWM. PWM filters noisily in the mid-level range, worst when set at 50%, therefore it requires an oversized capacitor to compensate. This of course makes the filter response much slower. Whereas PDM has consistence noise at all set levels, allowing for an optimised filter.
Here's an example using counterB. It's configured for 0 to 10000. If you prefer 16-bit resolution then just delete the scaling line from dacset().
Oops, small bug - DIRA should be OR'd with rather than overwritten.
or clearer still