JAJSQO0 june 2023 DAC539E4W
PRODUCTION DATA
The GPO pins are open drain outputs. These pins must be pulled up to the desired IO voltage using external resistors.
This example connects the AINx and OUTx pins to simplify routing. The OUTx pins must be disabled as the comparator outputs by setting the CMP-x-OUT-EN bit to 0 in the DAC-x-VOUT-CMP-CONFIG register, which is the default setting.
Use Equation 5 to calculate the threshold codes stored in DAC-x-DATA.
The DAC539E4W is a 10-bit device, which means the maximum DAC code is 1023d. For a 1-V VTHLD, DAC-0-DATA is calculated by Equation 6.
This result is rounded up to 205d (0x0CD). Table 8-2 lists the codes for the remaining threshold values.
THRESHOLD VOLTAGE | DAC-x-DATA[9:0] |
---|---|
1 V | 0x0CD |
2 V | 0x19A |
3 V | 0x266 |
4 V | 0x333 |
The AINx inputs are connected to the inverting input of the output buffer, and the threshold voltage is connected to the non-inverting input. By default, the comparator output is high when the voltage on AINx is lower than the threshold voltage. This example inverts the comparator outputs by setting the CMP-x-INV-EN bit in the DAC-x-VOUT-CMP-CONFIG register to 1.
By default the AINx inputs are high-impedance and the input voltage range is limited. This example sets the CMP-x-HIZ-IN-DIS bit in the DAC-x-VOUT-CMP-CONFIG register to 1 to connect the AINx inputs to a finite impedance. The input voltage range is 0 to VREF×Gain.
Table 8-36 shows the LUT configuration used in this example. This example application uses four different error codes, including 0b0000 representing no error. When the CMP0 and CMP1 outputs are high, the GPOs output 0b0011. When CMP2 is high, the GPOs output 0b0100. When all comparator outputs are high, the GPOs output 0b1111. All other conditions output 0b0000. Table 8-36 shows the LUT settings for this example.
COMPARATOR OUTPUT STATUS CMP3, CMP2, CMP1, CMP0 |
OUTPUTS GPO3, GPO2, GPO1, GPO0 |
---|---|
0b0000 | LUT-0-DATA: 0b0000 |
0b0001 | LUT-1-DATA: 0b0000 |
0b0010 | LUT-2-DATA: 0b0000 |
0b0011 | LUT-3-DATA: 0b0011 |
0b0100 | LUT-4-DATA: 0b0100 |
0b0101 | LUT-5-DATA: 0b0100 |
0b0110 | LUT-6-DATA: 0b0100 |
0b0111 | LUT-7-DATA: 0b0100 |
0b1000 | LUT-8-DATA: 0b0000 |
0b1001 | LUT-9-DATA: 0b0000 |
0b1010 | LUT-10-DATA: 0b0000 |
0b1011 | LUT-11-DATA: 0b0000 |
0b1100 | LUT-12-DATA: 0b0100 |
0b1101 | LUT-13-DATA: 0b0100 |
0b1110 | LUT-14-DATA: 0b0100 |
0b1111 | LUT-15-DATA: 0b1111 |
The CMPx outputs are read and the GPOs updated in a continuous loop. A loop refresh delay can be used to decrease the frequency of the loop to avoid any switching noise on the outputs as the voltage on the AINx pins settle. The timer is 5 bits and is stored in the LOOP-WAIT SRAM register. Use Equation 4 to calculate the delay. Set the LOOP-REFRESH code to 19d for a 41-ms delay.
Follow these guidelines to set up the registers on the DAC539E4W:
REGISTER NAME | ADDRESS [BITS] | ADDRESS LOCATION |
---|---|---|
DAC-0-DATA | 0x21[15:6] | SRAM |
DAC-1-DATA | 0x22[15:6] | SRAM |
DAC-2-DATA | 0x23[15:0] | SRAM |
DAC-3-DATA | 0x24[15:6] | SRAM |
LUT-0-DATA | 0x25[3:0] | SRAM |
LUT-1-DATA | 0x26[3:0] | SRAM |
LUT-2-DATA | 0x27[3:0] | SRAM |
LUT-3-DATA | 0x28[3:0] | SRAM |
LUT-4-DATA | 0x29[3:0] | SRAM |
LUT-5-DATA | 0x2A[3:0] | SRAM |
LUT-6-DATA | 0x2B[3:0] | SRAM |
LUT-7-DATA | 0x2C[3:0] | SRAM |
LUT-8-DATA | 0x2D[3:0] | SRAM |
LUT-9-DATA | 0x2E[3:0] | SRAM |
LUT-10-DATA | 0x2F[3:0] | SRAM |
LUT-11-DATA | 0x30[3:0] | SRAM |
LUT-12-DATA | 0x31[3:0] | SRAM |
LUT-13-DATA | 0x32[3:0] | SRAM |
LUT-14-DATA | 0x33[3:0] | SRAM |
LUT-15-DATA | 0x34[3:0] | SRAM |
LOOP-WAIT | 0x35[3:0] | SRAM |
DAC-0-VOUT-CMP-CONFIG | 0x03[12:10][4:0] | Register |
DAC-1-VOUT-CMP-CONFIG | 0x09[12:10][4:0] | Register |
DAC-2-VOUT-CMP-CONFIG | 0x0F[12:10][4:0] | Register |
DAC-3-VOUT-CMP-CONFIG | 0x15[12:10][4:0] | Register |
COMMON-CONFIG | 0x1F[15:0] | Register |
DEVICE-MODE-CONFIG | 0x25[15:0] | Register |
STATE-MACHINE-CONFIG0 | 0x27[2:0] | Register |
Only the bits listed in the address column of Table 8-4 are saved in NVM and used in the state machine. For example, only bits 12 to 10, and 4 to 0 are saved in NVM for the DAC-X-VOUT-CMP-CONFIG registers.
The pseudocode for this application example is as follows:
//SYNTAX: WRITE <REGISTER NAME (REGISTER ADDRESS)>, <MSB DATA>, <LSB DATA>
//Pull MODE pin low to enter programming mode//SYNTAX: WRITE <REGISTER NAME(Hex Code)>, <MSB DATA>, <LSB DATA>
//Stop the state machine
WRITE STATE-MACHINE-CONFIG(0x27), 0x00, 0x03
//Set the comparator thresholds
WRITE DAC-0-DATA(SRAM 0x21), 0x33, 0x40
WRITE DAC-1-DATA(SRAM 0x22), 0x66, 0x80
WRITE DAC-2-DATA(SRAM 0x23), 0x99, 0x80
WRITE DAC-3-DATA(SRAM 0x24), 0xCC, 0xC0
//Set the LUT values
WRITE LUT-0-DATA(SRAM 0x25), 0x00, 0x00
WRITE LUT-1-DATA(SRAM 0x26), 0x00, 0x00
WRITE LUT-2-DATA(SRAM 0x27), 0x00, 0x00
WRITE LUT-3-DATA(SRAM 0x28), 0x00, 0x03
WRITE LUT-4-DATA(SRAM 0x29), 0x00, 0x04
WRITE LUT-5-DATA(SRAM 0x2A), 0x00, 0x04
WRITE LUT-6-DATA(SRAM 0x2B), 0x00, 0x04
WRITE LUT-7-DATA(SRAM 0x2C), 0x00, 0x04
WRITE LUT-8-DATA(SRAM 0x2D), 0x00, 0x00
WRITE LUT-9-DATA(SRAM 0x2E), 0x00, 0x00
WRITE LUT-10-DATA(SRAM 0x2F), 0x00, 0x00
WRITE LUT-11-DATA(SRAM 0x30), 0x00, 0x03
WRITE LUT-12-DATA(SRAM 0x31), 0x00, 0x04
WRITE LUT-13-DATA(SRAM 0x32), 0x00, 0x04
WRITE LUT-14-DATA(SRAM 0x33), 0x00, 0x04
WRITE LUT-15-DATA(SRAM 0x34), 0x00, 0x0F
//Set the loop refresh setting for 41 ms
WRITE LOOP-WAIT(SRAM 0x35), 0x00, 0x13
//Set the channel 0 reference to VDD and enable comparator mode
WRITE DAC-0-VOUT-CMP-CONFIG(0x03), 0x04, 0x07
//Set channel 1 reference to VDD and enable comparator mode
WRITE DAC-1-VOUT-CMP-CONFIG(0x09), 0x04, 0x07
//Set channel 2 reference to VDD and enable comparator mode
WRITE DAC-2-VOUT-CMP-CONFIG(0x0F), 0x04, 0x07
//Set channel 3 reference to VDD and enable comparator mode
WRITE DAC-3-VOUT-CMP-CONFIG(0x15), 0x04, 0x07
//Power on the DAC channels
WRITE COMMON-CONFIG(0x1F), 0x02, 0x49
//Set the device mode (this is the device default)
WRITE DEVICE-MODE-CONFIG(0x25), 0x80, 0x40
//Start the state machine
WRITE STATE-MACHINE-CONFIG0(0x27), 0x00, 0x03
//Save settings to NVM
WRITE COMMON-TRIGGER(0x20), 0x00, 0x02
//Pull the MODE pin high to enter standalone mode