Can different analogWriteResolution values be set for DAC and PWM outputs ?

Status
Not open for further replies.

aalary

New member
I would like to use the Teensy LC's physical DAC at its full resolution (12-bit) whilst using the PWM outputs at a lower resolution (7-bit, to be able to run them faster).

But calling analogWriteResolution(7) reduces the usable resolution of the physical DAC too.

The physical DACs have a fixed real resolution, it seems to me that analogWrite() calls targeting the DACs should not be affected by the analogWriteResolution() function.

Maybe we need a separate DACWrite() function or maybe the analogWriteResolution() needs a pin number argument like analogWriteFrequency()?
 
try analogWriteDAC0(value) it is what is called by analogWrite() for DACs

hardware/teensy/avr/cores/teensy3/analog.c
 
Last edited:
try analogWriteDAC0(value) it is what is called by analogWrite() for DACs

hardware/teensy/avr/cores/teensy3/analog.c

That works, thanks!
That function call uses the full 12-bit resolution for the hardware DAC even when the PWM resolution is set to 7-bit with analogWriteResolution(7);
 
Status
Not open for further replies.
Back
Top