Monday, July 1, 2019

Use a MCP4728 DAC with AVR ATmega


The MCP4728 device is a quad channel, 12bit voltage output DAC. It also has EEPROM embedded.
The DAC is driven using the I2C interface.

This library implements an ATmega driver for this IC.


The selected I2C library is the one proposed by Peter Fleury, you can find it here: http://homepage.hispeed.ch/peterfleury/avr-software.html

This library can drive up to 8 IC, depending on the MCP4728 selected address.

Each individual channel can be powered down, then wake up.
User for setting gain, raw output value and voltage value is provided. Also values can be stored to IC EEPROM.

The reference voltage can be set as internal, that is 2.048V, or external.

The sample provided output a sine wave, or a voltage output test.

The max output voltage depends on the gain and the voltage reference selected, if external voltage is selected as reference the gain is omitted.


This project has been developed and tested on an ATmega8 running at 8Mhz.

Code

Notes
  • read risk disclaimer
  • excuse my bad english