Skip to content
alexanderhiam edited this page Dec 8, 2012 · 3 revisions

DACx311 is a library for PyBBIO to interface with TI's DACx311 series digital-to-analog converters:

  • DAC5311 - 8-bit
  • DAC6311 - 10-bit
  • DAC7311 - 12-bit
  • DAC8311 - 14-bit

They use an SPI insterface, and require 3 GPIO pins to communicate.

There is an example program at PyBBIO/examples/DACx311_test.py.

Note: the DACx311 DACs use their supply voltage as a reference, so if a different reverence voltage is used, level shifting of the SPI lines will be required.

API

Classes:

DAC5311

The class for the 8-bit DAC5311

DAC6311

The class for the 10-bit DAC6311

DAC7311

The class for the 12-bit DAC7311

DAC8311

The class for the 14-bit DAC8311

Methods:

Each class above has these methods.

init(data_pin, clk_pin, cs_pin, vref=3.3)

Each class is initialized with three GPIO pins for the SPI interface. The optional vref argument is the reference voltage of the DAC, which is used when converting values to voltages.

set(value)

Sets the output voltage of the DAC to the given integer value from 0 to 2(# of bits)-1 (so for the 8-bit DAC5311 that 0-255).

setVolts(volts)

Sets the output voltage of the DAC to the given floating point voltage.