-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Problem:
Attempting to latch the outputs VA-VD via LDAC does not work.
Outputs are updated immediately, regardless of the state of the LDAC pins.
More info and tests were reported at:
https://forums.adafruit.com/viewtopic.php?t=198312
https://forums.adafruit.com/viewtopic.php?t=199196
Analysis and findings:
The UDAC-bit is hard coded to "0" at every I2C write command.
adafruit_mcp4728.py line 224:
write_command_byte = 0b01000000 # 0 1 0 0 0 DAC1 DAC0 UDAC
suggested solution:
a) hard code UDAC-bit to "1"
adafruit_mcp4728.py line 224:
write_command_byte = 0b01000001 # 0 1 0 0 1 DAC1 DAC0 UDAC
and use LDAC-Pin to control the output ports
LDAC = True # output ports are locked (no updates)
LDAC = False # output ports are updated immediately
advantage: fast and easy to implement
disadvantage: hardcoded solution, ports cannot be controlled individually.
or
b) implement a function to control UDAC bit(s)
advantage: each port can be controlled individually
disadvantage: only one port can be selected at a time, but not all together!
suggested Enhancements (nice to have):
a) implement "Fast Write command" to write DAC Input Registers Sequentially from Channel A to D
b) implement "Multi-Write command" to write Multiple DAC Input Registers
c) implement faster clock speeds (400kHz, 1MHz, 3.4MHz), maybe as in busio.I2C