National Instruments 321645c-01 用户手册

下载
页码 554
Chapter 2
Function Reference — GPCTR_Set_Application
NI-DAQ FRM for PC Compatibles
2-228
©
 National Instruments Corporation
For example, assume that you want to generate a pulse 200 ns long after 150 ns of delay. 
You need to set 
ND_COUNT_1
 to 150 ns/50 ns = 3 and 
ND_COUNT_2
 to 200 ns/50 ns = 4. 
Figure 2-19 shows the scenario of a counter used for 
ND_SINGLE_PULSE_GNR
 after the 
following programming sequence:
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET) 
GPCTR_Set_Application(deviceNumber, gpctrNum, ND_SINGLE_PULSE_GNR)
GPCTR_Change_Parameter(deviceNumber, gpctrNum, ND_COUNT_1, 3) 
GPCTR_Change_Parameter(deviceNumber, gpctrNum, ND_COUNT_2, 4) 
Select_Signal(deviceNumber, gpctrNumOut, gpctrNumOut,ND_LOW_TO_HIGH)
GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM) 
In Figure 2-19, the following behavior is present:
Source is the signal present at the counter source input.
Output is the signal present at the counter output.
Armed is the value you would read from the counter if you called the 
GPCTR_Watch
 
function with entityID =
ND_ARMED
. The different values illustrate behavior at different 
times.
Figure 2-19.  Single Pulse Generation
Use the 
GPCTR_Watch
 function with entityID = 
ND_ARMED
 to monitor the progress of the 
pulse generation process. The generation completes when entityValue becomes 
ND_NO
.
Typically, you find modifying of the following parameters through the 
GPCTR_Change_Parameter
 function useful when the counter application is 
ND_SINGLE_PERIOD_MSR
. You can change the following:
ND_COUNT_1
 and 
ND_COUNT_2
 to any value between 2 and 2
24
 – 1 for E Series and 445X 
devices, and to any value between 2
32 
– 1 for 6602 and 455X devices. The defaults are 
given for illustrative purposes only. 
ND_SOURCE
 to 
ND_INTERNAL_100_KHZ
. With this timebase, you can generate pulses 
with a delay and length between 20 µs and 160 s for E Series and 445X devices and 
Source
Armed
No
Output
No
Count_1 = 3
Count_2 = 4
Yes