Chapter 4
Programming
©
National Instruments Corporation
4-43
4.
Call
AO_Updating
to program the update interval.
Use the external UPDATE mode.
Set the UPDATE source to PFI5.
5.
Perform Analog Output Example 3 Steps 4 through 7.
Example 5
This example generates a waveform using interrupts to write data 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 5 times.
Confirm operation with an oscilloscope.
Instead of installing the interrupt service routine (ISR) as an interrupt, this
example emulates the operation of the interrupt by polling the status
register in the DAQ-STC. When the status register indicates an interrupt,
the main loop transfers control to the ISR. To use the example ISR as an
actual interrupt, you need to learn how to install software interrupts on your
system. Generally, the procedure is as follows:
1.
Determine the software interrupt number corresponding to the IRQ
line you are using.
2.
Use the OS specific functions, such as
getvect( )
and
setvect( )
for DOS, to replace the default interrupt handler with your ISR. You
should disable interrupts during this step.
3.
Reset the interrupt controller hardware.
4.
Perform your analog output.
5.
After the analog output operation completes, you should re-install the
default interrupt handler.
Example Program
1.
Perform Analog Output Example 2 Steps 1 through 14.
2.
Call
AO_FIFO
to disable the FIFO retransmit and set the FIFO mode.
Joint_Reset_Register
AO configuration start = 1;
AO_Mode_2_Register
AO FIFO Mode = 1;
AO FIFO retransmit enable = 0;