I've seen where you can use the A/D converted to convert an analog pin value to digital. Can you do the reverse? Output an analog value on a pin based on a digital value??
There is a built-in Digital to Analog converter module in the XMega series of AVRs.
You can also use a dedicated DAC chip.
You can also use a plain old port to output 1's and 0's to an R2R Ladder, which converts the digital value to an analog voltage.
You can also output a pulse stream, with a variable duty cycle, fed to an RC low pass filter, which will give you an analog output voltage.
Lots of options exist!
Check this out:(Direct digital synthesis)
I remember in one of the posts there was a link to a DDS implementation using AVR. Will post it if I find it.
Jespers Mini-DDS using a mega and an R/2R ladder, not an xmega:
Stealing Proteus doesn't make you an engineer.
Here's my version of Jesper's Mini-DDS using a DAC chip:
I've converted his code for the Atmel assembler.
Leon Heller G1HSM
AVR335 is worth a squint too.
I implemented an arbitrary waveform generator on my XMEGA project:
You can see a video here:
It uses the XMEGA's internal DAC and the DMA. Once the waveform is setup, it requires no CPU intervention.
© 2021 Microchip Technology Inc.