In this post, I program the current mode of the DAC8775, the subject of the Quad-Channel, Analog Output Module RoadTest. |
Configurable Current
Additional to the traditional voltage mode, this DAC can source current. It has a number of ranges that can be controlled:
In this exercise I'm setting the mode to 0101: 0 - 20 mA.
In code:
TX_Data_Master[0] = 0x04; TX_Data_Master[1] = 0x10; // output on, default slew rate TX_Data_Master[2] = 0x05; // slew rate off, 0 - 20 mA mode /* Initiate SPI3 Transmit and Receive through Polling Mode */ spiTransmitAndReceiveData(spiREG3, &dataconfig1_t, 3, TX_Data_Master, RX_Data_Master);
I've used the EEVBlog µCurrent to measure the current. I've wired it straight over the outputs. The DAC has the duty to generate the requested current for the µCurrent's shunt.
It has headroom of +15 to -15 V to do this, because that's the range I've set the DAC's internal Buck-Boosters at.
In the photo at the top of the article, I'm pushing 20 mA, and have set the µCurrent to mA mode. It uses a 0R01 shunt in that case.
The µCurrent outputs 1 mV per mA of current in that mode and my multimeter reads 19 mA. We're in the ballpark.
Note: my DMM, a Brymen BM235, doesn't have a lower voltage range. All measurements are within the specs of meter, µCurrent and DAC.
The code to generate 20 mA:
TX_Data_Master[0] = 0x05; TX_Data_Master[1] = 0xff; TX_Data_Master[2] = 0xff; /* Initiate SPI3 Transmit and Receive through Polling Mode */ spiTransmitAndReceiveData(spiREG3, &dataconfig1_t, 3, TX_Data_Master, RX_Data_Master);
For these current levels, you don't need a µCurrent. Most DMMs have a low enough Burden voltage (internal shunt) to deal with that.
Once we're in the lower bit range of the DAC, the µCurrent shows it value.
0xffff is 20 mA. If we divide the value by 1024, we get 0x003f, and the output should be 19.53125 µA.
TX_Data_Master[0] = 0x05; TX_Data_Master[1] = 0x00; TX_Data_Master[2] = 0x3f; /* Initiate SPI3 Transmit and Receive through Polling Mode */ spiTransmitAndReceiveData(spiREG3, &dataconfig1_t, 3, TX_Data_Master, RX_Data_Master);
With the µCurent in µA mode (shunt is 10R), I measure 18 µA. Again close.
Top Comments