creativecontrol_circuitpython_ltc166x

CircuitPython library for control of LTC166X 8-bit and 10-bit DACs.

  • Author(s): Thadeus Frazier-Reed

Implementation Notes

The library provides options for storing all DAC values in a list or a list of lists for DAC daisy-chains. A channel may be marked for no update using a negative number (i.e. -1) This value will be skipped or a no change message will be sent in the case of a daisy-change.

TODO:

Hardware:

Multiple LTC1665/LTC1660’s can be controlled from a single 3-wire serial port (i.e., SCK, DIN and CS/LD) by using the included “daisy-chain” facility. A series of m chips is configured by connecting each DOUT (except the last) to DIN of the next chip, forming a single 16m-bit shift register. The SCK and CS/LD signals are common to all chips in the chain. In use, CS/LD is held low while m 16-bit words are clocked to DIN of the first chip; CS/LD is then pulled high, updating all of them simultaneously.

Software and Dependencies:

class creativecontrol_circuitpython_ltc166x.LTC1660(sck: Pin, mosi: Pin, csel: Pin, debug: bool = False)

Extended class for 10bit Octal DAC

class creativecontrol_circuitpython_ltc166x.LTC1665(sck: Pin, mosi: Pin, csel: Pin, debug: bool = False)

Extended class for 8bit Octal DAC

class creativecontrol_circuitpython_ltc166x.LTC166X(sck: Pin, mosi: Pin, csel: Pin, debug: bool = False)

LTC166X 8 or 10-bit digital to analog converter.

Parameters:
get_bit_depth()

Return bit_depth based on device used.

get_device_range()

Return device range based on device used.

sleep(dac)

Put DAC in sleep mode.

wake_no_change(dac)

Wake DAC with no value updates.

write_chained_dac_value(value: list, address: int, chain_length: int)

Write a single DAC value to a chain.

Parameters:
  • value (list) – DAC value from 0 to device range.

  • address (int) – DAC address DAC A = 1 … DAC H = 8 … ALL DACs = 15.

  • chain_length (int) – Number of DACs in the chain.

write_chained_dac_values(dac_values: list)

Write list of values to a chain of DACs. All lists should be the same length. Do not update if value is < 0. This allows for comparison of update frames and only updating if value has changed.

Parameters:

dac_values (list) – list of lists of values from 0 to device range.

Each list represents a DAC’s channel values. [[DAC 1], [DAC 2], [DAC 3], etc.]

write_dac_value(value: int, address: int)

Write a single DAC value.

Parameters:
  • value (int) – DAC value from 0 to device range.

  • address (int) – DAC address DAC A = 1 … DAC H = 8 … ALL DACs = 15.

write_dac_values(values: list)

Write to list of values to DAC. Do not update if value is < 0. This allows for comparison of update frames and only updating if value has changed.

Parameters:

values (list) – list of values from 0 to device range.

write_value_to_spi(spi: SPIDevice, value: int, address: int)

Write a single value to SPI.

Parameters:
  • spi (SPIDevice) – adafruit_bus_device.spi_device.

  • value (int) – DAC value from 0 to device range.

  • address (int) – DAC address DAC A = 1 … DAC H = 8 … ALL DACs = 15.