ZHCUD83 August 2025
可通过许多方式配置 DAC。示例如下:
ftdiObject.spiWrite(PAGE_ADDRESS, PAGE_DAC_CONFIG) #Set the page to DAC CONFIG, Page 3
#Set the DAC current limits. This sets all the DACs to max current limit, 120mA
ftdiObject.spiWrite(DAC_CURRENT_ADDRESS, 0xFFFF)
#Set the OUT CLAMPs. This sets OUTA0 CLAMP = DACA1, OUTA2 CLAMP = DACA3, OUTB0 CLAMP = DACB1, OUTB2 CLAMP = DACB3
ftdiObject.spiWrite(DAC_CFG_ADDRESS, DAC_CFG_CLAMP_SEL_OUTA0_OUTA0clampvoltageisDACA1 + DAC_CFG_CLAMP_SEL_OUTA2_OUTA2clampvoltageisDACA3 + DAC_CFG_CLAMP_SEL_OUTB0_OUTB0clampvoltageisDACB1 + DAC_CFG_CLAMP_SEL_OUTB2_OUTB2clampvoltageisDACB3)
#Disables DAC broadcast and Syncronous modes.
ftdiObject.spiWrite(DAC_SYNC_CFG_ADDRESS, 0x0000)
#Set the DAC Alarm Powerdown settings. This sets the register to default - All DACs power down to VSS during an Alarm.
ftdiObject.spiWrite(DAC_APD_EN_ADDRESS, DAC_APD_EN_DEFAULT)
#Configure what Alarms trigger each DACs. This enables all alarms)
ftdiObject.spiWrite(DACA_APD_SRC_0_ADDRESS, 0x0133)
ftdiObject.spiWrite(DACA_APD_SRC_1_ADDRESS, DACA_APD_SRC_1_DEFAULT)
ftdiObject.spiWrite(DACB_APD_SRC_0_ADDRESS, 0x0133)
ftdiObject.spiWrite(DACB_APD_SRC_1_ADDRESS, DACB_APD_SRC_1_DEFAULT)
ftdiObject.spiWrite(OUTA_APD_SRC_0_ADDRESS, 0x0133)
ftdiObject.spiWrite(OUTA_APD_SRC_1_ADDRESS, OUTA_APD_SRC_1_DEFAULT)
ftdiObject.spiWrite(OUTB_APD_SRC_0_ADDRESS, 0x0133)
ftdiObject.spiWrite(OUTB_APD_SRC_1_ADDRESS, OUTB_APD_SRC_1_DEFAULT)
#Set the DRVEN pin configuration. This sets the OUT pins to toggle with DRVEN0, and disables DRVEN1.
ftdiObject.spiWrite(DRVEN0_EN_ADDRESS, DRVEN0_EN_DRVEN0_EN_DACA0_En + DRVEN0_EN_DRVEN0_EN_DACA2_En + DRVEN0_EN_DRVEN0_EN_DACB0_En + DRVEN0_EN_DRVEN0_EN_DACB2_En)
ftdiObject.spiWrite(DRVEN1_EN_ADDRESS, 0x0000)
"""Set DAC voltage"""
ftdiObject.spiWrite(PAGE_ADDRESS, PAGE_DAC_BUFFER) #Set DAC Buffer page, Page 4
#DAC voltage (Positive) = (DAC_CODE * 10)/2^13
#DAC Voltage (Negative) = (DAC_CODE * 10)/2^13 - 10
ftdiObject.spiWrite(DACA0_ADDRESS, 0x1570) # -3.3V or 6.7V depending on output range.
ftdiObject.spiWrite(DACB0_ADDRESS, 0x0A8F) # 3.3V or -6.7V depending on output range.