Chapter 4
Programming
©
National Instruments Corporation
4-47
Interrupt_A_Enable_Register
G0_TC_Interrupt_Enable = 0;
G0_Gate_Interrupt_Enable = 0;
5.
Call
G0_Arm()
to begin the operation.
G0_Command_Register
G0_Arm=1;
6.
Call
G0_Watch()
to read the save registers.
do {
G0_Command_Register
G0_Save_Trace=0;
G0_Command_Register
G0_Save_Trace=1;
/* Compare the counter content; if they are not the same, read again*/
save_1=G0_Save_Registers (24 bits);
save_2=G0_Save_Registers (24 bits);
if (save_1!= save_2)
save_1=G0_Save_Registers (24 bits);
} while (save_1<=10000); // Count until it exceeds 10000
Example 2
This is the example for buffered pulsewidth measurement.
The counter uses G_In_TimeBase as G_Source to measure the signal’s
pulsewidth on PFI4 (G_Gate), counting the number of edges that occur on
G_Source. At the completion of each pulsewidth interval for G_Gate,
software reads the counter values from the HW_Save_Registers. An
interrupt occurs after each measurement. Readings are done after each
generated interrupt.
For more information about how to install the software interrupt, please see
Example 5 in the
section, or Example 3 in the
section.
1.
Perform General Purpose Counter and Timer Example 1 Step 1
through 3.
2.
Call
Buffered_Pulse_Width_Measurement()
to set up the
DAQ-STC for buffered pulse width measurement.
Go_Mode_Register
G0_Load_Source=0;