mcp4728 is microchip I2C 4 channel DAC with eeprom.

I write a library for mcp4728 because I replace ad5254 to mcp4728 in the newer version of HP RGB LED Shield that I will post later.

It is basically 4 channel version of mcp4725 ( you can find the break out board from sparkfun). If you want to have mcp4725, let me know. I will write a library.

Basic spec of mcp4728.

- Quad 12-bit voltage output Digital-to-Analog Convertor (DAC)

- I2C communication with programmable address.

- Internal or External voltage reference

- EEPROM for default values.

Documentation

I did not fully document the source code yet. Example files have description for functions.

Here is a part of example file. full example pde code

#include <Wire.h>
#include “mcp4728.h”

void setup()
{
Serial.begin(9600);  // initialize serial interface for print()
dac.begin();  // initialize i2c interface

}

void loop()
{

/*
Basic analog writing to DAC
*/

dac.analogWrite(500,500,500,500); // write to input register of DAC four channel (channel 0-3) together. Value 0-4095
dac.analogWrite(0,700); // write to input register of a DAC. Channel 0-3, Value 0-4095
int value = dac.getValue(0); // get current input register value of channel 0
Serial.print(“input register value of channel 0 = “);
Serial.println(value, DEC); // serial print of value

dac.voutWrite(1.8, 1.8, 1.8, 1.8) // write to input register of DAC. Value (V < VDD)
dac.voutWrite(2, 1.6) // write to input register of DAC. Channel 0 – 3, Value (V < VDD)
float vout = dac.getVout(1); // get current voltage out of channel 1
Serial.print(“Voltage out of channel 1 = “);
Serial.println(vout, DEC); // serial print of value

}

Source code

http://code.google.com/p/neuroelec/

Download

http://code.google.com/p/neuroelec/downloads/list