Chapter 4
Programming
4-42
©
National Instruments Corporation
General-Purpose Counter/Timer
There are two 24-bit up/down counters available for performing event
counting, pulse-width measurement, pulse and pulse train generation, etc.
Associated with each counter are load and save registers. You can use
interrupts with these counters to do buffered measurements. Each time the
counter generates an interrupt, a new set of values can be loaded into the
counters.
You can select the input signals to the counters from any of the
17 (10 PFI + 7 RTSI) external timing I/O pins. Signals can also be output
on certain dedicated lines. For example, the pin name PFI8/CTRSRC0
means that the clock source input for Counter 0 can come from any of the
PFI/RTSI lines but can be output only on the PFI8 line.
Chapter 4 of the DAQ-STC Technical Reference Manual contains all the
information on the general-purpose counter and timer module of
DAQ-STC, with specific programming steps in the programming
information section. Example 1 illustrates simple gated event counting.
Example 2 shows buffered pulse width measurement, and Example 3
provides the framework for continuous pulse generation.
Example 1
This is the example for gated event counting. G0 counter counts the number
of pulses (rising edge) that occur on the G_Source after software arm and
G_Gate trigger. Using PFI3 as G_Source and PFI4 as G_Gate. Trigger
signal from G_Gate starts and stop the counter. After the G_Gate trigger,
read from the save register and display the content. Counting and reading
will stop when counter hits 10000.
1.
Setup the Plug and Play resource. Use the Setup_PNP_Board()
function provided on the Companion Disk.
2.
Call MSC_IO_Pin_Configure() to set all the PFI pins for input.
IO_Bidirection_Pin_Register
BD_i_Pin_Dir <= 0;
3.
Call G0_Reset_All() to reset all the necessary registers in DAQ-STC.
Joint Reset Register
G0_Reset=1;
G0_Mode_Register=0x0000;
G0_Command_Register=0x0000;
G0_Input_Select_Register=0x0000;
Содержание AT-AI-16XE-10
Страница 131: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 2 National Instruments Corporation...
Страница 132: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 3 AT MIO E Series RLPM...
Страница 133: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 4 National Instruments Corporation...
Страница 134: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 5 AT MIO E Series RLPM...
Страница 135: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 6 National Instruments Corporation...
Страница 136: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 7 AT MIO E Series RLPM...
Страница 137: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 8 National Instruments Corporation...
Страница 138: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 9 AT MIO E Series RLPM...
Страница 139: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 10 National Instruments Corporation...
Страница 140: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 11 AT MIO E Series RLPM...
Страница 141: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 12 National Instruments Corporation...
Страница 142: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 13 AT MIO E Series RLPM...
Страница 143: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 14 National Instruments Corporation...
Страница 144: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 15 AT MIO E Series RLPM...
Страница 145: ...Appendix A OKI MSM82C55A Data Sheet AT MIO E Series RLPM A 16 National Instruments Corporation...
Страница 146: ...Appendix A OKI MSM82C55A Data Sheet National Instruments Corporation A 17 AT MIO E Series RLPM...