Chapter 4
Programming
4-34
©
National Instruments Corporation
AO_Command_1_Register
AO LDAC0 source select = 0;
AO DAC0 update mode = 0;
AO LDAC1 source select = 0;
AO DAC1 update mode = 0;
Joint_Reset_Register
AO configuration start = 0;
AO configuration end = 1;
6.
Write to the DAC1 Data Register. In bipolar mode, +10 V corresponds
to 2,047 (0x07FF) and –10 V corresponds to –2,048 (0xF800). Hence,
+5 V corresponds to 1,024 (0x0400). Writing this to the DAC1 data
register results in +5 V appearing at the DAC1OUT line.
Example 2
This example generates a waveform using polled writes to the data FIFO.
Initialize the buffer with 3000 points. Use polled writes to write each point
to the data FIFO. Updates occur every 2 ms. Output the buffer five times.
Confirm operation with an oscilloscope.
1.
Perform Analog Output Example 1 Step 1.
2.
Load an array with the voltages of the waveform to be output. In
bipolar mode, +10 V corresponds to 2,047 (0x07FF) and –10 V
corresponds to –2,048 (0xF800). To convert the voltage you want to
output to the binary value, use the following formula:
binary value = (voltage/10) * 2048
3.
Configure the board by setting the following board level bits.
AO_Configuration_Register:
DACSel<3..0> = 1;
BipDac = 1;
ExtRef = 0;
ReGlitch = 0;
GroundRef = 0;
4.
Reset the data FIFO.
5.
Pre-load the data FIFO with the voltages from the array.
while (FIFO is not full and there is more data to write)
{
AO_DAC_FIFO_Data = data;
}