adafruit_mcp4728

Helper library for the Microchip MCP4728 I2C 12-bit Quad DAC

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_mcp4728.CV

struct helper

classmethod add_values(value_tuples)

creates CV entires

classmethod is_valid(value)

Returns true if the given value is a member of the CV

class adafruit_mcp4728.Channel(dac_instance, cache_page, index)

An instance of a single channel for a multi-channel DAC.

All available channels are created automatically and should not be created by the user

gain

Sets the gain of the channel if the Vref for the channel is Vref.INTERNAL. The gain setting has no effect if the Vref for the channel is `Vref.VDD`.

With gain set to 1, the output voltage goes from 0v to 2.048V. If a channe’s gain is set to 2, the voltage goes from 0v to 4.096V. gain Must be 1 or 2

normalized_value

The DAC value as a floating point number in the range 0.0 to 1.0.

raw_value

The native 12-bit value used by the DAC

value

The 16-bit scaled current value for the channel. Note that the MCP4728 is a 12-bit piece so quantization errors will occour

vref

Sets the DAC’s voltage reference source. Must be a VREF

class adafruit_mcp4728.MCP4728(i2c_bus, address=96)

Helper library for the Microchip MCP4728 I2C 12-bit Quad DAC.

Parameters:
  • i2c_bus (I2C) – The I2C bus the MCP4728 is connected to.
  • address – The I2C slave address of the sensor
save_settings()

Saves the currently selected values, Vref, and gain selections for each channel to the EEPROM, setting them as defaults on power up

sync_gains()

Syncs the driver’s gain state with the DAC

sync_vrefs()

Syncs the driver’s vref state with the DAC

class adafruit_mcp4728.Vref

Options for vref