
DMM-16R-AT User Manual V1.31
www.diamondsystems.com
Page 34
11. GENERATING AN ANALOG OUTPUT
This chapter describes the steps involved in generating an analog output (also called performing a D/A
conversion) on a selected output channel using direct programming (not with the driver software).
There are three steps involved in performing a D/A conversion:
1. Compute the D/A code for the desired output voltage
2. Write the value to the selected output channel
3. Update the D/A
11.1 Compute the D/A code for the desired output voltage
Use the formulas on the preceding page to compute the D/A code required to generate the desired voltage.
Note:
The DAC cannot generate the actual full-scale reference voltage; to do so would require an output
code of 4096, which is not possible with a 12-bit number. The maximum output value is 4095. Therefore the
maximum possible output voltage is 1 LSB less than the full-scale reference voltage.
11.2 Write the value to the selected output channel
The four DACs share a single address for the LSB, Base + 1. Each DAC then has its own MSB address.
Writing to the DAC’s MSB address causes the 12-bit value to be loaded into the DAC. Therefore the LSB
must be written first.
First use the following formulas to compute the LSB and MSB values:
LSB = D/A Code AND 255 ;keep only the low 8 bits
MSB = int(D/A code / 256) ;strip off low 8 bits, keep 4 high bits
Example: Output code = 1776
LSB = 1776 AND 255 = 240 (F0 Hex); MSB = int(1776 / 256) = int(6.9375) = 6
(In other words, 1776 = 6 * 256 + 240)
Now write these values to the selected channel:
Write LSB to Base + 1
Write MSB to Base + 4 , Base + 5, Base + 6, or Base + 7 depending on the channel no.
11.3 Update the D/A
Read from any address in the range Base + 4 through Base + 7 to update the DACs. All four DACs are
updated at the same time, so you can write data to multiple DACs and then perform a single read operation
from any of the four addresses to update all of them at once.
Any DAC that has not had new data loaded into it will maintain its current value.