Monday, July 1, 2019

Use a MCP4728 DAC with AVR ATmega

Updated to version 04

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:

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.

  • 04: fixed eeprom functions
  • 03: added mcp4728_setdacvdd, mcp4728_setchannelvalue methods
  • 02: first version.

  • read risk disclaimer
  • excuse my bad english