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.1Compute the D/A code for the desired output voltage D/A code = desired output voltage in mV
⇒Note: The DAC cannot generate the actual
11.2Write the value to the selected output channel
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)
Then write these values and the D/A channel no. to the board:
Write LSB to Base + 0
Write MSB to Base + 1
Write the channel no. to Base + 7
11.3 Update the D/A
Write a 1 to the DAUPD bit in Base + 7 to update the D/A.
To update several channels simultaneously, follow steps 1 and 2 for each channel. After all channel data has been written, write a 1 to the DAUPD bit, and all channels with new data will be updated simultaneously.
Page 35 |