The DAQ-STC is warranted against defects in materials and workmanship for a period of one year from the date of
shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace
equipment that proves to be defect ive du ring t he wa rranty period . Th is warranty incl udes parts a nd l abor.
The media on which you receive National Instruments software are warranted not to fail to execute programming
instructions, due to defects in materials and work man ship, for a peri od of 90 d ays from da te o f sh ipm ent, as evi denced
by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not
execute programming instructions if National Instruments receives noti ce of su ch defect s d uring th e warranty perio d.
National Instruments does not warrant that the op eration of t he soft ware shall b e uni nterrup ted or erro r free.
A Return Material Authorization (RMA) number must b e ob tain ed fro m th e facto ry an d clearl y mark ed on t he outsi de
of the package before any equipment wil l be accepted for warranty work. National Instruments will pay the shippi ng costs
of returning to the owner parts which are covered by warran ty.
National Instruments believes that the information in this document is accurate. The document has been carefully
reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves
the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The
reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for
any damages arising out of or related to th is d ocum ent o r th e in form ation con tained in i t.
XCEPT AS SPECIFIED HEREIN
E
ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE
CUSTOMER
OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF
National Instruments will apply regardless of the form of action, wh ether in con tract or tort , incl udin g n egli gen ce.
Any action against National Instruments must be brought within one year after the cause of action accrues. National
Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty
provided herein does not cover damages, defects, malfuncti ons, or s ervice failur es caused by own er’s fai lure to fol low
the National Instruments installation, operation, or maintenance instructions; owner’s modification of the product;
owner’s abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties,
or other events outside reasonable control.
ATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS
. N
ATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS
, N
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical,
including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without
the prior written consent of National Instruments Corporation.
USTOMER’S RIGHT TO RECOVER DAMAGES CAUSED
. C
. This limitation of the liability of
,
Trademarks
CVI™, DAQ-STC™, NI-DAQ™, and RTSI™ are trademarks of National Instruments Corporation.
Product and company names mentioned herein are trademarks or trade names of their respective companies.
WARNING REGARDING MEDICAL AND CLINICAL USE OF NATIONAL INSTRUMENTS PRODUCTS
National Instruments products are not designed with com ponent s and tes ting inten ded to ensure a l evel of reliab ilit y
suitable for use in treatment and diagnosis of humans. Applications of National Instruments products invol ving m edical
or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the
user or application designer. Any use or application of National Instruments products for or involving medical or clinical
treatment must be performed by properly trained and qualified medical personnel, and all traditional medical safeguards,
equipment, and procedures that are appropriate in the particular situation to prevent serious injury or death should always
continue to be used when National Instruments products are being used . National Instrum ents product s are NOT intended
to be a substitute for any form of established process, procedure, or equipment used to monitor or safeguard human health
and safety in medical or clinical treatment.
Page 4
Contents
About This Manual
Organization of This Manual.........................................................................................xxiii
Conventions Used in This Manual.................................................................................xxv
National Instruments Documentation.......................................................................... ..xxvi
Related Documentation........................................... .......................................................xxvi
National Instruments CorporationxxiDAQ-STC Technical Reference Manual
Page 21
About This Manual
The DAQ-STC is an application-specific integrated circuit (ASIC)
designed by National Instruments. The DAQ-STC Technical Reference Manual describes the programmable features of the DAQ-STC and is
intended for programmers who need to program the DAQ-STC on an
existing data acquisition (DAQ) board and for hardware engineers who
want to design a DAQ board using the DAQ-STC.
Before using this manual to program the DAQ-STC on an existing board,
you should be familiar with the board that contains your DAQ-STC. You
should begin by reading the user manual for the board containing the
DAQ-STC. Next, read the register-level programmer manual for the same
board. The register-level programmer manual refers to some of the sections
in this manual.
When you are familiar with the material in the register-level programmer
manual, you can refer directly to the DAQ-STC Technical Reference
Manual. Programmers should have to read only the Programming
Information section of each chapter in order to program the DAQ-STC.
Hardware engineers may need to read further for more detailed information
about hardware operation.
Organization of This Manual
The DAQ-STC Technical Reference Manual is organized as follows:
•Chapter 1, Introduction, describes the data acquisition system timing
controller (DAQ-STC), an application-specific integrated circuit
(ASIC) for the system timing requirements of a general-purpose A/D
and D/A system, such as a system containing the National Instruments
multifunction I/O boards.
•Chapter 2, Analog Input Timing/Control, describes the analog input
timing/control module (AITM), which generates timing for the ADC
and controls signals for the associated circuitry.
•Chapter 3, Analog Output Timing/Control, describes the analog output
timing/control module (AOTM), which generates timing for the D ACs
and controls signals for the associated circuitry, such as the data FIFO
buffers.
National Instruments CorporationxxiiiDAQ-STC Technical Reference Manual
Page 22
About This Manual
•Chapter 4, General-Purpose Counter/Timer, presents information
about the general-purpose counter/timer (GPCT) module of the
DAQ-STC.
•Chapter 5, Programmable Function Inputs, explains the PFI module
on the DAQ-STC.
•Chapter 6, RTSI Trigger, describes the features of the RTSI trigger
module (RTM) and explains how to program the RTSI interface.
•Chapter 7, Digital I/O, describes the digital I/O (DIO) module and
explains how to use it on the DAQ-STC.
•Chapter 8, Interrupt Control, describes the interrupt control module
(ICM), its features, and the conditions that cause interrupts.
•Chapter 9, Bus Interface, describes the features of the bus interface
module, gives programming instructions, and presents the timing
diagrams for the bus interface.
•Chapter 10, Miscellaneous Functions, discusses the miscellaneous
functions not covered in the other chapters. The miscellaneous
functions include clock distribution, the programmable frequency
output, analog triggering, and test mode.
•Appendix A, Specifications, contains specifications for the DA Q-STC.
•Appendix B, Register Information, contains information about the
DAQ-STC registers and bitfields.
•Appendix C, Pin List, contains lists of the DAQ-STC pins.
•Appendix D, DAQ-STC Revision History, lists the differences between
the first two revisions of the DAQ-STC and identifies those boards
containing the first revision of the DAQ-STC.
•Appendix E, Customer Communication, contains forms you can use to
request help from National Instruments or to comment on our products
and manuals.
•The Glossary contains an alphabetical list and description of terms
used in this manual, including abbreviations, acronyms, metric
prefixes, mnemonics, and symbols.
•The Index contains an alphabetical list of key terms and topics in this
manual, including the page where you can find each one.
The following conventions are used in this manual:
<>Angle brackets containing numbers separated by an ellipsis represent a
range of values associated with a bit or signal name—for example,
ACH<0..7> stands for ACH0 through ACH7.
This icon to the left of bold italicized text denotes a note, which alerts you
to important information.
!
boldBold text denotes the names of menu items, or dialog box buttons or
bold italicBold italic text denotes a note, caution, or warning.
deviceDevice refers to any hardware that contains DAQ-STC.
italicItalic text denotes emphasis, a cross reference, or an introduction to a key
moduleModule refers to each functional group in the DAQ-STC, as shown in
monospaceText in this font denotes text or characters that you should literally enter
This icon to the left of bold italicized text denotes a caution, which advises
you of precautions to take to avoid injury, data loss, or a system crash.
This icon to the left of bold italicized text denotes a warning, which advises
you of precautions to take to avoid being electrically shocked.
options.
concept.
Figure 1-3, DAQ-STC Block Diagram.
from the keyboard, sections of code, programming examples, and syntax
examples. This font is also used for the proper names of disk drives, paths,
directories, programs, subprograms, subroutines, device names, functions,
operations, variables, filenames and extensions, and for statements and
comments taken from programs.
National Instruments CorporationxxvDAQ-STC Technical Reference Manual
Page 24
About This Manual
National Instruments Documentation
The DAQ-STC Technical Reference Manual is one piece of the
documentation set for your data acquisition system. You could hav e any of
several types of manuals depending on the hardware and software in your
system. Use the manuals you have as follows:
•Getting Started with SCXI—If you are using SCXI, this is the first
manual you should read. It gives an overview of the SCXI system and
contains the most commonly needed information for the modules,
chassis, and software.
•Y our SCXI hardw are user manuals—If you are using SCXI, read these
manuals next for detailed information about signal connections and
module configuration. They also explain in greater detail how the
module works and contain application hints.
•Your DAQ hardware user manuals—These manuals have detailed
information about the DAQ hardware that plugs into or is connected
in your computer. Use these manuals for hardware installation and
configuration instructions, specification information about your DAQ
hardware, and application hints.
•Software manuals—Examples of software manuals you may have are
the LabVIEW and LabWindows/CVI manual sets and the NI-DAQ
manuals. After you set up your hardware system, use either the
application software (LabVIEW or LabWindo ws/CVI) manuals or the
NI-DAQ manuals to help you write your application. If you have a
large and complicated system, it is worthwhile to look through the
software manuals before you configure your hardware.
•Accessory manuals—If you are using accessory products, read the
terminal block and cable assembly installation guides. They explain
how to physically connect the relevant pieces of the system. Consult
these guides when you are making your connections.
•SCXI chassis manuals—If you are using SCXI, read these manuals for
maintenance information on the chassis and installation instructions.
Related Documentation
The following National Instruments documents contain general
information and operating instructions for the DAQ-STC:
•Application Note 010: Programming Interrupts for Data Acquisition
on 80x86-Based Computers
Customer Communication
National Instruments wants to receive your comments on our products
and manuals. We are interested in the applications you develop with our
products, and we want to help if you have problems with them. To make it
easy for you to contact us, this manual contains comment and configuration
forms for you to complete. These forms are in Appendix E, Customer
National Instruments CorporationxxviiDAQ-STC Technical Reference Manual
Page 26
Introduction
This chapter describes the data acquisition system timing controller (DAQ-STC), an
application-specific integrated circuit (ASIC) for the system timing requirements of a
general-purpose A/D and D/A system, such as a system containing the National Instruments
multifunction I/O (MIO) boards.
The DA Q-STC contains nine modules, or function groups. These function groups include the
analog input timing/control module, analog output timing/control module, general-purpose
counter/timer module, programmable function inputs module, RTSI trigger module, digital
I/O module, interrupt control module, bus interface module, and the miscellaneous functions
module.
The counters and support logic within the analog input timing/control and analog output
timing/control modules supply timing and control signals to independent A/D and D/A
subsystems.
Two counters in the general-purpose counter/timer module implement event-counting,
time-measurement, and pulse-generation functions, and supply timing and trigger signals to
the other modules.
1
The programmable function inputs and RTSI trigger modules have internal multiplexers to
route signals among the DAQ-STC and the RTSI and I/O connectors so that you can operate
the board with external timing and trigger signals, or you can output internally generated
timing and trigger signals to either connector.
The digital I/O module enables you to transfer serial and parallel data between the CPU and
an external device.
The interrupt control module simplifies software design by routing both board-level and
internally generated interrupts to the CPU subsystem, and the bus interface module enables
the DAQ-STC to communicate easily with most computer buses.
Finally, the miscellaneous functions module provides extra features such as clock
distribution, the programmable frequency output, and analog triggering.
National Instruments Corporation1-1DAQ-STC Technical Reference Manual
Page 27
Chapter 1Introduction
1.1 DAQ-STC Applications
The primary function of the DA Q-STC is to provide timing and control for the A/D and D/A
subsystems of a DAQ board. To understand the DAQ-STC, you should be familiar with a
typical implementation of an A/D and D/A board. This section presents a typical
implementation of these two primary functions and familiarizes you with the components
controlled by the DAQ-STC. The remaining functions, such as digital I/O and
general-purpose counting, are self-contained and independent and can, therefore, be
understood without discussing any specific implementation.
1.1.1 Analog Input Application
Figure 1-1 shows the primary components of an analog input subsystem. On an analog input
board, a sample/hold circuit samples the analog value of one or more input channels, and an
A/D converter (ADC) converts the analog value to a digital value. A FIFO then holds the
digital data until it can be transferred to the host system memory.
Analog
Channels
Sample/Hold
Hold
Clock,
Retransmit
Mux
Select
Configuration
FIFO
Analog
Processing
Gain,
Polarity,
SE/diff
Convert
ADC
Clock
AI Data
FIFO
I/O Connector
FIFO Empty,
Ghost
Timing/Trigger
Analog Input Timing/Control
RTSI Connector
DAQ-STC
Timing/Trigger
Figure 1-1.
Analog Input Application
The analog channels enter the board through the I/O connector, as shown at the left of the
figure. The DA Q-STC supplies a hold command to latch the analog values at the sample/hold
device. On boards with multiple-input channels, a multiplexer selects each channel, one at a
time, and applies its voltage to the ADC. The DAQ-STC instructs the ADC to begin the
conversion and monitors the progress through status flags. When the con v ersion is complete,
the DAQ-STC clocks the digital data into the AI data FIFO until it can be retrieved by the
system bus.
The DA Q-STC monitors the status of the AI data FIFO so that the DA Q-STC can generate an
interrupt or a DMA request when the FIFO fills beyond a programmable threshold. On many
boards, a configuration FIFO is available to provide gain control and channel selection. The
DAQ-STC supplies a clock and a retransmit signal for the configuration FIFO and monitors
the FIFO empty flag. The ghost signal from the configuration FIFO inhibits the AI data FIFO
clock to provide a multirate sampling capability. T iming and trigger signals pass to and from
the DAQ-STC and the I/O and RTSI connectors for external timing applications.
1.1.2 Analog Output Application
Figure 1-2 shows the primary components of an analog output subsystem. On an analog
output board, the CPU typically writes the output data into the AO data FIFO, and one or more
D/A converters (DACs) subsequently convert the digital data to an analog form.
National Instruments Corporation1-3DAQ-STC Technical Reference Manual
Analog Output Timing/Control
DAC Write
DAQ-STC
RTSI Connector
Figure 1-2.
DAC Address
Timing/Trigger
Analog Output Application
DACs
Update
Timing/Trigger
I/O Connector
Page 29
Chapter 1Introduction
The DA Q-STC monitors the status of the A O data FIFO so that it can generate an interrupt or
a DMA request when the FIFO empties beyond a programmable threshold. The DAQ-STC
can also supply a retransmit signal to the AO data FIFO if the FIFO is large enough to hold
the entire buffer. When the output data is needed at the converters, the DAQ-STC clocks the
data from the FIFO into the DA Cs using the D AC write and DAC address signals. An update
signal allows all of the DACs to update their outputs simultaneously.
The CPU can also write directly to the DA Cs, using the CPU request signal to request that the
DAQ-STC allow access. The DAQ-STC arbitrates between itself and the CPU, notifying the
CPU that the write has completed using the channel ready signal. Timing and trigger signals
pass to and from the DAQ-STC and the I/O and RTSI connectors for external timing
applications.
1.2 DAQ-STC Block Diagram
Figure 1-3 shows a block diagram of the DA Q-STC. The diagram shows all of the I/O signals
as well as the direction of the signal—input, output, or bidirectional. Each chapter of this
manual discusses one of the modules depicted in this block diagram.
This chapter describes the analog input timing/control module (AITM), which generates
timing for the ADC and controls signals for the associated circuitry. The AITM contains a
24-bit scan interval counter (SI), a 24-bit scan counter (SC), a 16-bit sample interval counter
(SI2), and a 16-bit divide down counter (DIV).
There are eight timing and control signals associated with the analog input. These are the scan
interval clock (SI source), sample interval clock (SI2 source), ADC conversion strobe
(CONVERT), trigger (START1), second trigger (START2), start scan (START), stop scan
(STOP), and external gate. The AITM contains independent multiplexers and conditioning
circuits to derive these timing/control signals from any of 10 programmable function input
(PFI) signals (PFI<0..9>), seven RTSI trigger signals (RTSI_TRIGGER<0..6>), or other
internal signals.
This chapter presents a list of the AITM features, followed by a simplified model that
introduces a few AITM-related signals, an overvie w of each of the AITM modes, a list of the
external pins used by the AITM module, programming information for users who need to
program the hardware at a low level, a complete list of the AITM timing diagrams, and a
detailed description of the internal workings of the AITM. The final section is intended for
advanced users. Read section 1.1.1, Analog Input Application, for more information about
devices with which the AITM can work.
2
2.1.1 Programming the AITM
To program the AITM of the DAQ-STC, read the following:
•Section 1.1.1, Analog Input Application
•Sections 2.2, Features, through 2.6, Programming Information
As you read section 2.6, Programming Information, you will need to refer to section 2.7,
Timing Diagrams. You will also need to consult the register-le vel programmer manual for the
hardware containing the DA Q-STC. If you need additional help programming the AITM, read
section 2.8, Detailed Description.
National Instruments Corporation2-1DAQ-STC Technical Reference Manual
Page 31
Chapter 2Analog Input Timing/Control
2.2 Features
The AITM has the following features:
•Scan interval timing
–24-bit scan interval down counter
–Maximum frequency of 20 MHz yi elds 50 ns resolutio n with a maximum interv al of
0.83 s
–Divide-by-two timebase yields 100 ns resolution with a maximum interval of 1.67 s
–Divide-by-200 timebase yields 10 µs resolution with a maximum interval of 167 s
•Sample interval counter
–16-bit sample interval down counter
–Maximum sample rate of 10 MS/s
–Maximum interval of 3.3 ms between channels with 50 ns resolution
•External timing for the following signals
–START
–START1
–START2
–CONVERT
–SI source, with special considerations for the SI2 source
–STOP
–External gate
•Bidirectional external timing pins
–Input timing and control signals from PFI<0..9> and RTSI_TRIGGER<0..6>
–Output the most important internally generated timing and control signals to the
board
•Programmable polarities for clock sources, trigger inputs, and the most important timing
outputs
•Ability to change the scan rate during an acquisition, in combination with the GPCT
module or directly in software
•Scan count
–24-bit scan down counter
–Trigger up to 2
•Trigger modes
–Hardware and software triggering
–Support for versatile analog triggering
•Delayed trigger
–Interval counters have alternate first period capability for retriggerable delay from
trigger
–Minimum delay of one SI source clock
–Maximum delay of 2
24
SI source clocks
•Pretrigger
–Count pretrigger scans and ignore START2 triggers until the pretrigger count has
been satisfied
–Synchronize multiple DAQ-STCs in th e pretrigg er mode
•Gating
–Hardware and software gating
•Seamless interface to the configuration FIFO and the data FIFO
•Error detection
–Overrun and overflow error-detection flags for internal or external timing
–Error detection for excessive interrupt latency during staged analog input
•Bus interface support
–Interrupts based on triggers, error conditions, and FIFO flags
–FIFO-flag-based request signal to simplify DMA request logic
•Seamless interface to external analog input accessories
–Multiplexer
–16-bit counter can generate internal multiplexer clock by dividing down the external
multiplexer clock
–Provides a clock for the external multiplexer
–Simultaneous sample and hold
–Generates the track-and hold-signal
National Instruments Corporation2-3DAQ-STC Technical Reference Manual
Page 33
Chapter 2Analog Input Timing/Control
2.3 Simplified Model
The AITM contains the hardware necessary to generate timing and control signals for the
ADC and the associated circuitry on a National Instruments DAQ board, such as an MIO
board. Figure 2-1 shows the timing and control signals used in a typical analog input
operation.
START1
START
STOP
CONVERT
Figure 2-1.
Typical Analog Input Waveform
The primary analog input timing signal is the CONVERT pulse, which instructs the ADC to
begin a conversion on the selected analog input channel. CONVER T pulses are organized into
groups called scans. In each scan, the CONVERT signal pulses once for each input channel.
The purpose of the scan grouping is to sample multiple input channels nearly simultaneously.
Each scan begins with a START pulse and ends with a STOP pulse. The START1 trigger
begins the acquisition sequence. Figure 2-1 above depicts an acquisition consisting of three
scans, with each scan sampling four input channels.
Figure 2-2 shows a simplified model of the AITM module.
Chapter 2Analog Input Timing/Control
RTSI_TRIGGER<0..6>
PFI<0..9>
AI_STOP_IN
SOC
EOC
GHOST
AIFFF
AIFHF
AIFEF
SELECT
CONTROL
START1
SC_TC
STOP
START
SI2
COUNTER
SI
COUNTER
SI_TC
DIV_TC
DIV
COUNTER
SC
COUNTER
SI2_TC
OUTPUT
CONVERT
LOCALMUX_CLK
LOCALMUX_FFRT
EXTMUX_CLK
AI_FIFO_SHIFTIN
SHIFTIN
AIFREQ
SCAN_IN_PROG
Figure 2-2. AITM Simplified Model
One of the primary features of the AITM is that a wide variety of signals can be selected as
timing and control sources. The simplified model depicts this as a select circuit, which
chooses between the 10 PFI signals PFI<0..9>, the seven RTSI signals
RTSI_TRIGGER<0..6>, and the dedicated STOP input signal AI_STOP_IN. Many of the
signals required for the ADC can come from external sources routed through the selector . The
DAQ-STC can also generate the timing sources internally.
The simplified model in Figure 2-2 shows that the source for the CONVERT pulse may come
from the SI2 counter (internal CONVERT source) or the select circuit (external CONVERT
source). SOC (start of conversion) and EOC (end of conversion) are status signals generated
by the ADC. SOC indicates that a conv ersion has be gun and EOC indicates that a conversion
is complete.
Using CONVERT as a reference, the output circuit generates several ancillary signals used
on the board. The LOCALMUX_CLK (configuration FIFO advance) signal, which pulses
after an integral number of CONVERTs, advances the configuration FIFO to the next input
channel. The LOCALMUX_FFRT (configuration FIFO retransmit) signal, which pulses
when the configuration FIFO empties, refills the configuration FIFO. The EXTMUX_CLK
(external multiplexer clock) signal, which pulses on e very CONVERT, adv ances the channel
multiplexer . The SHIFTIN signals (AI_FIFO_SHIFTIN and SHIFTIN), which pulse after the
ADC has completed a conversion, move the data into the analog input data FIFO. The
AIFREQ (AI data FIFO request) signal generates a DMA request based on the analog input
National Instruments Corporation2-5DAQ-STC Technical Reference Manual
Page 35
Chapter 2Analog Input Timing/Control
FIFO flags AIFEF (AI data FIFO empty flag), AIFHF (AI data FIFO half-full flag), and
AIFFF (AI data FIFO full flag). Refer to section 2.5, Pin Locator Interface, for a complete
description of these signals.
The configuration FIFO may also supply the GHOST signal, which is updated on every
CONVERT. When the GHOST input is active, the AI_FIFO_SHIFTIN pulse is suppressed
following the conversion, so that the ADC data is not shifted into the AI data FIFO. This
feature allows the DAQ-STC to support multirate sampling where channels are sampled at
different input rates.
As shown in Figure 2-2, the STA RT pulse may come from the SI counter (internal START
source) or the PFI selector (external START source). Similarly, the STOP pulse may come
from the DIV counter (internal STOP source) or the PFI selector (external STOP source). The
SCAN_IN_PROG output indicates that a scan is in progress by asserting on START and
deasserting on STOP.
The SC counter is available to count the number of scans that have occurred. This is useful
for generating a specific number of scans in an acquisition. The ST AR T1 trigger signal begins
the acquisition sequence and may come from one of several sources—PFI, R TSI, software, or
general-purpose counter 0.
2.4 Analog Input Functions
The AITM is a highly flexible circuit that can accommodate a variety of timing scenarios. The
most useful of these is the interval scanning mode. For this reason, the functional description
will present interval scanning as the primary analog input mode.
For the purpose of discussion, the analog input functions can be divided into three
groups—low-level timing and control, scan-level timing and control, and acquisition-level
timing and control. Low-level timing and control refers to the timing signals related to and
derived from CONVER T. Scan-level timing and control refers to the timing signals necessary
to organize the CONVERT pulses into scans. Acquisition-level timing and control refers to
the timing signals that govern the generation of scan sequences.
2.4.1 Low-Level Timing and Control
This section discusses CONVERT and the signals derived from CONVERT.
The CONVERT signal is the primary timing signal for analog input. Three board-level
subsystems are controlled by CONVERT and the signals derived from CONVERT—the
ADC, the data FIFO, and the configuration FIFO and external multiplexer . CONVERT timing
is affected by your selection of internal or external CONVERT mode.
The basic function of the ADC control signals is to time ADC conversions and load the
resulting digital data into a latch. The primary output signals are CONVERT and SHIFTIN,
and the input signals are SOC and EOC. Figure 2-3 shows these signals in a basic data
acquisition sequence.
CONVERT
SOC
EOC
SHIFTIN
Figure 2-3.
ADC Control
The SOC input informs the DAQ-STC when a conversion starts. Similarly, the EOC input
notifies the DAQ-STC when a conversion completes. The assertion of EOC leads to the
assertion of SHIFTIN, which loads the acquired data into its destination. An overrun
condition occurs when the conversion rate is too high for the A/D subsystem to maintain. If a
second CONVERT signal occurs before the current conversion is complete, the DAQ-STC
flags an overrun error and generates an interrupt if programmed to do so.
2.4.1.2 Data FIFO Control
Many DA Q products include data FIFOs to pre vent loss of data at high speeds and to increase
bus bandwidth. The data FIFO control signals support such a FIFO. The SHIFTIN signal
loads the result of each conversion into the data FIFO. Three status flags indicate the amount
of data stored in the FIFO and are monitored by the DAQ-STC. The three status flags are
AIFFF , AIFHF, and AIFEF. When the FIFO flags indicate that the FIFO lev el has exceeded a
programmed threshold, the DAQ-STC notifies the host computer using either an interrupt
request, if the CPU performs data transfers, or the DMA request signal AIFREQ, if the DMA
controller performs data transfers. The host computer then transfers the input data stored in
the data FIFO to main memory.
2.4.1.3 Configuration FIFO and External Multiplexer Control
Typical DAQ products provide a means of setting channel, gain, polarity, and other
configuration information for the A/D subsystem. Recent products offer the ability to change
this information on a per conversion basis. The DAQ-STC fully supports a FIFO-based
configuration memory that can update on every CONVERT pulse. Typically, the
configuration FIFO contains one data word for each input channel included in the scan. At the
National Instruments Corporation2-7DAQ-STC Technical Reference Manual
Page 37
Chapter 2Analog Input Timing/Control
end of the scan, the FIFO read pointer is reset, effectively reloading the FIFO with the
configuration list. The LOCALMUX_CLK signal, which asserts at the same time as
CONVERT, advances the configuration FIFO. At the leading edge of the final
LOCALMUX_CLK, the configuration FIFO becomes empty, causing MUXFEF to assert.
When MUXFEF asserts, LOCALMUX_FFRT pulses on the trailing edge of
LOCALMUX_CLK, causing the configuration FIFO to reload the entire configuration list.
Figure 2-4 shows the operation of these signals during two scans, where each scan contains
four channels.
CONVERT
LOCALMUX_CLK
DIV Counter
EXTMUX_CLK
MUXFEF
LOCALMUX_FFRT
1010
Figure 2-4. Configuration FIFO Control
In addition to supporting the configuration FIFO, the DAQ-STC also supports an external
multiplexer. Typically, analog input boards are limited to eight or 16 input channels. An
external multiplexer overcomes this limitation by time division, multiplexing several analog
signals onto each input channel. Each memory location in the configuration FIFO
corresponds to one input channel. With an external multiplexer, the configuration FIFO does
not advance until all the external channels have been sampled for a given input channel. The
EXTMUX_CLK signal is available to advance the external multiplexer.
T o use the DA Q-STC with an external multiplex er, you load the DIV counter with the number
of external channels corresponding to each input channel. The EXTMUX_CLK signal pulses
on every CONVERT, but the LOCALMUX_CLK signal pulses only when the DIV counter
reaches state 0. Figure 2-5 shows the operation of these signals during a scan where four
external channels are multiplexed onto each of two input channels.
As discussed in section 2.3, Simplified Model, sequences of CONVERT pulses are organized
into scans, which begin on START and terminate on STOP. The DAQ-STC can generate the
timing for the individual CONVERT pulses using the SI2 counter (internal CONVERT), or
the timing for CONVERT can come from an external source (e xternal CONVERT). With an
external CONVERT, the SI2 counter is unused.
Internal CONVERT
In the internal CONVERT mode, the hardware generates the CONVERT pulses on SI2_TC
(SI2 counter TC). The ST AR T trigger causes the SI2 counter to begin counting and the STOP
trigger causes the SI2 counter to stop counting. Refer to section 2.4.2, Scan-Level Timing and
Control, for more information on the START trigger. The STOP trigger, which asserts after
the appropriate number of conversions, usually comes from the configuration FIFO. A second
option for generating the STOP trigger, an internal STOP, is to configure the DIV counter to
count the number of conversions, load the DIV counter with the number of conversions per
scan, then use the DIV counter TC as the STOP signal. However, you cannot use an internal
STOP and an external multiplexer at the same time because they both use the DIV counter.
The SI2 counter has dual load registers that allow two timing parameters at the CONVERT
timing level. The first parameter , A, gi ves the delay from START to the first CONVERT. The
second parameter, B, giv es the delay between CONVER T pulses. The SI2 reload mode setting
allows the SI2 counter to alternate load registers on every STOP, thus providing the dual
timing feature.
National Instruments Corporation2-9DAQ-STC Technical Reference Manual
Page 39
Chapter 2Analog Input Timing/Control
Figure 2-6 shows two scans with four internally timed CONVERT pulses each to indicate the
available timing parameters. The SCAN_IN_PROG output asserts on START and deasserts
at the completion of the scan.
START
STOP
SCAN_IN_PROG
CONVERT (SI2_TC)
Timing Parameter
ABBBABBB
Figure 2-6. Internal CONVERT Timing
External CONVERT
In the external CONVERT mode, the externally generated CONVERT pulses enter the
DAQ-STC through one of the PFI<0..9> or RTSI_TRIGGER<0..6> inputs. In order to
preserve the concept of interval scanning with an external CONVERT, the STST_GATE
(Start/Stop Gate) is available. The START trigger enables the STST_GATE and the STOP
trigger disables the STST_GATE.
External CONVERT pulses that occur when the STST_GATE is enabled pass through the
DAQ-STC. External CONVERT pulses that occur when the STST_GATE is disabled are
blocked.
Timing for the external CONVERT can be arbitrarily complex depending on the behavior of
the signal you select as the external CONVERT source. Typically, though, you will select a
periodic signal, in which case the only timing parameter available is the delay between
CONVERT pulses. The delay from START to the first CONVERT depends on the
relationship between the START trigger and the external CONVERT and can vary.
Figure 2-7 shows two scans with four externally timed CONVERT pulses each and indicates
how the delay from START to the first CONVERT can vary. The SCAN_IN_PROG output
asserts on the recognition of START and deasserts on STOP.
Although successive CONVERT pulses in Figure 2-7 are equidistant, they could follow any
other timing.
2.4.2 Scan-Level Timing and Control
As discussed in section 2.3, Simplified Model, sequences of CONVERT pulses are organized
into scans. Each scan begins with a START pulse. The START pulse may come from either
the SI counter (internal START mode) or the PFI selector (external START mode).
Chapter 2Analog Input Timing/Control
2.4.2.1 Internal START Mode
In the internal START mode, the SI_TC (SI counter TC) signal becomes the START pulse.
The ST AR T1 trigger causes the SI counter to generate the ST ART pulses which continue until
the acquisition sequence is complete. Refer to section 2.4.3, Acquisition-Level Timing and
Control, for more information on the START1 trigger.
The SI counter has dual-load registers that allow for two timing parameters at the START
timing level. The first parameter (A) gives the delay from START1 to the first START. The
second parameter (B) gives the delay between START pulses.
National Instruments Corporation2-11DAQ-STC Technical Reference Manual
Page 41
Chapter 2Analog Input Timing/Control
Figure 2-8 shows three scans of four CONVERT pulses each to indicate the timing
parameters that are available.
Timing Parameter
START1
START (SI_TC)
STOP
CONVERT
ABBB
Figure 2-8. Internal START
2.4.2.2 External START Mode
In the external START mode, the externally generated START pulses enter the DAQ-STC
through one of the PFI<0..9> or RTSI_TRIGGER<0..6> inputs or from general-purpose
counter 0. When the counters are armed and a START1 pulse is received, the DAQ-STC is
ready to recognize external START pulses. Each external START initiates a scan, causing the
DAQ-STC to generate CONVERT pulses until a STOP is received. If the external START
pulses occur at a rate higher than the DAQ-STC can maintain, the extra external START
pulses are ignored.
The timing for the external START can be arbitrarily complex depending on the behavior of
the signal you select as the external START source. Typically, though, you will select a
periodic signal, in which case the only timing parameter available is the delay between
START pulses. The delay from START1 to the first START depends on the relationship
between the START1 trigger and the external START and can vary.
Figure 2-9 shows three scans of four CONVERT pulses each, where the scans are initiated by
an external START.
External START
START1
START
STOP
CONVERT
Figure 2-9. External START
In the external START mode, the SI special trigger delay feature of the SI counter allows an
extra timing parameter in the scan timing. This feature allows you to enforce a minimum
delay from the START1 trigger to the first START. When the SI special trigger delay is
enabled, the SI counter blocks external START pulses for a fixed time period after the
START1 trigger. Software can program the SI counter to count edges on the internal
IN_TIMEBASE signal for an absolute time delay, or it can program the SI counter to count
edges on the external START signal for a delay in terms of the number of START pulses
blocked.
Figure 2-10 depicts the SI special trigger delay feature where the SI counter counts edges on
the internal IN_TIMEBASE signal. The START1 pulse causes the SI counter to begin
counting. External START pulses are not recognized until the SI_TC. This feature gives the
user greater control over the external START timing.
National Instruments Corporation2-13DAQ-STC Technical Reference Manual
Page 43
Chapter 2Analog Input Timing/Control
2.4.3 Acquisition-Level Timing and Control
The SC counter is available to control the acquisition-level timing. Two trigger signals are
available for acquisition-level timing—the START1 trigger and the START2 trigger. The
DA Q-STC has three acquisition-level timing modes—posttrigger mode, pretrigger mode, and
continuous acquisition mode. This section discusses the operation of the START1 and
START2 triggers in the context of these three timing modes.
2.4.3.1 Posttrigger Acquisition Mode
In the posttrigger acquisition mode, only one parameter is required—the number of scans to
complete. The START1 pulse initiates the scan sequence. The SC counter counts the number
of scans and terminates the acquisition upon completion of the programmed number of scans.
Posttrigger acquisitions can be retriggerable or nonretriggerable. In the retriggerable mode,
additional START1 pulses that occur after SC_TC initiate additional acquisition sequences.
In the nonretriggerable mode, only one acquisition sequence is allowed. Externally generated
START1 and START2 triggers enter the DAQ-STC through one of PFI<0..9> or
RTSI_TRIGGER<0..6>.
Figure 2-11 shows a single-posttrigger acquisition sequence consisting of three scans.
START1
START
STOP
CONVERT
SC Counter
SC_TC
210
Figure 2-11.
Posttrigger Acquisition Mode
2.4.3.2 Pretrigger Acquisition Mode
In the pretrigger acquisition mode, two parameters are required. The first parameter gives the
pretrigger count requirement; that is, the number of scans that must occur before ST AR T2 can
be recognized. The second parameter gives the posttrigger count requirement; that is, the
number of scans that will occur after START2 is recognized.
The START1 pulse initiates the scan sequence. After the pretrigger count requirement has
been satisfied, the DAQ-STC looks for the START2 trigger while continuing to generate
scans. When the ST AR T2 trigger has been receiv ed, the hardware generates a specific number
of additional scans according to the posttrigger count requirement. Pretrigger acquisitions can
be retriggerable or nonretriggerable. In the retriggerable mode, additional START1 pulses
initiate additional acquisition sequences. In the nonretriggerable mode, only one acquisition
sequence is allowed. Alternatively, START1 can come from general-purpose counter 0.
Figure 2-12 shows a single pretrigger acquisition sequence with a pretrigger count
requirement of four scans and a posttrigger scan requirement of three scans. The total number
of scans acquired before START2 occurs is six because the START2 trigger occurs after the
sixth scan but before the start of the second scan. The vertical lines indicate where the SC
counter transitions occur.
START1
START2
START
STOP
SC Counter
SC_TC
Don't Care
321022210
Figure 2-12. Pretrigger Acquisition Mode
2.4.3.3 Continuous Acquisition Mode
In the continuous acquisition mode, the START1 trigger initiates the scan sequence. The
hardware continues to generate scans until the software issues an AI_End_On_End_Of_Scan
command, an AI_End_On_SC_TC command, or a software reset command. The
AI_End_On_End_Of_Scan command terminates the scan sequence at the end of the next
scan. The AI_End_On_SC_TC command terminates the scan sequence at the next SC_TC
(SC counter TC). The software reset command terminates the scan sequence immediately.
National Instruments Corporation2-15DAQ-STC Technical Reference Manual
Page 45
Chapter 2Analog Input Timing/Control
2.4.3.4 Staged Acquisition
Staged acquisition refers to the software action required to implement more than one
posttrigger acquisition sequence, each having unique timing parameters. This section
discusses how the software might handle staged acquisition.
In a programming sequence that occurs prior to the START1 trigger, software loads the
parameter values for the first two acquisition sequences. Software also configures the
counters to switch load registers after each acquisition sequence has completed, providing for
the switch from one sequence to the next. While the second sequence is in progress, software
loads the parameters for the third sequence into the unused load registers. Switching between
load registers occurs at the end of each sequence, that is, at SC_TC. This arrangement allows
the software a maximum latency of up to the duration of the sequence in progress to finish
writing the set of values for the next sequence into the alternate load register set.
Error detection is provided in case the next parameter set is not written in the allotted time.
The error-detection circuit is armed on each SC_TC. If a software clear does not occur before
the next SC_TC, the error-detection circuit latches an SC_TC error condition.
2.4.3.5 Master/Slave Trigger
Use master/slave triggers whenever you need DAQ devices with multiple DAQ-STC ASICs
to acquire data in a synchronized manner; that is, when multiple ASICs share the same
ST ART1 and START2 triggers. With master/slave triggering, one DAQ-STC is designated to
be the master trigger ASIC, sourcing the START1 and START2 triggers to the other ASICs
through the PFI<0..9> or RTSI_TRIGGER<0..6> interf ace. This arrangement provides better
synchronization than if all DA Q-STC ASICs recei ve the same START1 and STAR T2 triggers
independently, because different ASICs may synchronize differently.
In master/slave triggering, all DAQ-STC AITMs are timed from a common source. The
master ASIC delays recognition of the START1 and START2 triggers by one source period
to allow the slave ASICs adequate time to receiv e the triggers. On the following source edge,
all of the ASICs simultaneously begin the programmed acquisition sequence. Master/slave
triggering can be used with any of the three acquisition modes—pretrigger, posttrigger, or
continuous acquisition mode.
2.4.4 Gating
The DAQ-STC also supports gating, an additional external control layer. Both an external
source coming through the PFI<0..9> or RTSI_TRIGGER<0..6> interface and software can
supply the optional control signal. Gating provides a mechanism to pause the data acquisition
operation. When the START signal is internally generated (by the SI counter), gating is
available in two modes—free-run and halt. When the START signal is externally generated,
only free-run gating is available. In all modes, the conversion signal CONVERT is gated on
a scan basis; that is, entire scans are gated on or off.
In the free-run gating mode, the scan timing continues without interruption while the outputs
are gated off. For the internal START case, the SI counter continues to count regardless of the
gating signal. If the external gate is asynchronous to the SI source (internal ST ART mode) or
to the external ST AR T , the delay between active gate le vel and first con version of a scan varies
and can be as long as one scan interval.
Figure 2-13 shows two scans and the location of the third scan had it not been gated off.
START1
External Gate
START
STOP
CONVERT
STARTs blocked
Figure 2-13.
Free-Run Gating Mode
2.4.4.2 Halt-Gating Mode
Halt-gating mode is available only when the START signal is generated internally. In the
halt-gating mode, the delay from the assertion of the external gate to the next CONVERT is
minimized. The SI counter counts down normally until it reaches a count value of one. At this
point, the behavior of the SI counter depends upon the external gate. If the external gate is
deasserted, the SI counter pauses so that no START pulses are generated. When the external
gate asserts, the START occurs immediately (with jitter of up to one SI source clock period).
The external gate works as a pseudotrigger for a scan in this mode.
National Instruments Corporation2-17DAQ-STC Technical Reference Manual
Page 47
Chapter 2Analog Input Timing/Control
Figure 2-14 shows three scans where the second scan has been delayed by the action of the
external gate. START is asserted immediately upon the assertion of the external gate.
START1
External Gate
START (SI_TC)
STOP
CONVERT
2.4.5 Single-Wire Mode
In the single-wire mode, one signal is used as both an external START and an external
CONVERT. Interval-scan timing is still permitted, although the number of timing parameters
is quite limited. Figure 2-15 shows an example of three scans of four CONVERT pulses each
in single-wire mode.
The I/O signals relevant to analog input are listed in Table 2-1. An asterisk following a pin
name indicates that the default polarity for that pin is active low.
Pin Type Notation:
IUInput, pull up (50 kΩ)
IU5Input, pull up (5 kΩ)
O4TUOutput, 4 mA sink, 2.5 mA source tri-state, pull up (50 kΩ)
O9TUOutput, 9 mA sink, 5 mA source, tri-state, pull up (50 kΩ)
Chapter 2Analog Input Timing/Control
Table 2-1.
Pin NameTypeDescription
AIFEF*IUData FIFO Empty Flag—This input generates the FIFO
interrupt and the FIFO request signal (AIFREQ) based on the
status of the FIFO. The input polarity is selectable, and the
input state can be directly observed in one of the status
registers. Source: AI data FIFO. Related bitfields:
AI_FIFO_Flags_Polarity, AI_FIFO_Empty_St.
AIFFF*IUData FIFO Full Flag—This input is used to generate the FIFO
interrupt and the FIFO request signal (AIFREQ) based on the
status of the FIFO. The input polarity is selectable, and the
input state can be directly observed in one of the status
registers. Source: AI data FIFO. Related bitfields:
AI_FIFO_Flags_Polarity, AI_FIFO_Full_St.
AIFHF*IUData FIFO Half-full Flag—This input generates the FIFO
interrupt and the FIFO request signal (AIFREQ) based on the
status of the FIFO. The input polarity is selectable, and the
input state can be directly observed in one of the status
registers. Source: AI data FIFO. Related bitfields:
AI_FIFO_Flags_Polarity, AI_FIFO_Half_Full_St.
AI_FIFO_SHIFTIN*O9TUData FIFO Write Clock—This output shifts the ADC data
from the ADC into the data FIFO at the end of conversion.
The AI_FIFO_SHIFTIN pulse is asserted on EOC and
remains asserted based on the selected pulsewidth. The
AI_FIFO_SHIFTIN pulse is inhibited for the conv ersions that
occur when the GHOST signal is active. Output polarity is
selectable. Destination: AI data FIFO. Options: Active Low,
Active High. Related bitfields: AI_SHIFTIN_Polarity,
AI_SHIFTIN_Pulse_Width.
National Instruments Corporation2-19DAQ-STC Technical Reference Manual
Page 49
Chapter 2Analog Input Timing/Control
Table 2-1. Pin Interface (Continued)
Pin NameTypeDescription
AIFREQO4TUData FIFO Request—This output is a FIFO request signal
that indicates that the data FIFO contains data that requires
service. The AIFREQ signal is generated directly from the
data FIFO status flags (AIFEF, AIFHF, and AIFFF) and the
internal SC_TC signal. Output polarity is selectable.
Destination: DMA Controller or CPU. Options: Active Low ,
Active High. Related bitfields: AI_AIFREQ_Polarity,
AI_FIFO_Mode.
AI_STOP_INIU5Dedicated STOP Input—This input provides a optimized
path for the end-of-scan signal (LAST_CH) from the
configuration FIFO. Internally, the AI_STOP_IN signal is
routed directly to the STOP selector. Source: Configuration
FIFO. Related bitfields: AI_STOP_Select.
AI_STOP_OUTO4TUDedicated STOP Output—This output reflects the state of the
active high internal STOP signal. The hardware generates
AI_STOP_OUT and the internal STOP signal by passing the
output of the STOP selector through polarity selection, edge
detection, and synchronization. Output polarity is selectable.
Related bitfields: AI_STOP_Select, AI_STOP_Polarity,
AI_STOP_Edge, AI_STOP_Sync, AI_STOP_St.
CONVERT*O9TUADC Conversion Strobe—This output instructs the ADC to
perform a conversion. The hardw are generates CONVERT by
passing the internal sample clock (SCLK) signal through
pulsewidth and polarity selection circuitry . Output polarity is
selectable. Destination: ADC. Options: Active Low, Active
High, Ground, High Z. Related bitfields:
AI_CONVERT_Output_Select, AI_CONVERT_Pulse,
AI_CONVERT_Original_Pulse,
AI_CONVERT_Pulse_Timebase,
AI_CONVERT_Pulse_Width.
DIV_TCO4TUDIV Counter TC Signal—Output polarity is active high.
Related bitfields: Misc_Counter_TCs_Output_Enable.
EOCIUEnd of Conversion—This input indicates that a conv ersion is
complete. Internally, the EOC signal causes the SHIFTIN
pulse to be generated and causes the overrun error-detection
circuitry to end the overrun-detection interval (in overrun
mode 0). The input polarity is selectable, and the input state
can be directly observed in one of the status registers. Source:
ADC. Related bitfields: AI_EOC_Polarity, AI_EOC_St,
AI_Overrun_Mode.
EXTMUX_CLKO9TUExternal Multiplexer Clock—This output pulses after each
CONVERT to clock an external multiplexer such as the
AMUX-64, causing the multiplexer to switch to the next
entry in the external scan list. T wo output modes are av ailable
for the EXTMUX_CLK output. In the first mode,
EXTMUX_CLK trails the LOCALMUX_CLK pulse by
0.5 - 1.5 AI_OUT_TIMEBASE periods and has a pulsewidth
of 4.5 AI_OUT_TIMEBASE periods. In the second mode,
EXTMUX_CLK and LOCALMUX_CLK are asserted at the
same time (when LOCALMUX_CLK is asserted), and their
pulsewidths are equal. Output polarity is selectable.
Destination: External Multiplexer. Options: Active Low,
Active High, Ground, High Z. Related bitfields:
AI_EXTMUX_CLK_Output_Select,
AI_EXTMUX_CLK_Pulse,
AI_EXTMUX_CLK_Pulse_Width.
GHOSTIUGhost Input—This active high input masks the
AI_FIFO_SHIFTIN pulses associated with specific channels
to allow multirate scanning. The GHOST signal is produced
by the configuration FIFO containing the scan list. Source:
Configuration FIFO.
National Instruments Corporation2-21DAQ-STC Technical Reference Manual
Page 51
Chapter 2Analog Input Timing/Control
Table 2-1. Pin Interface (Continued)
Pin NameTypeDescription
LOCALMUX_CLK*O4TUConfiguration FIFO Advance Clock—This output clocks the
local configuration FIFO containing the scan list, thereby
updating the channel, gain, and channel configuration
selections. The LOCALMUX_CLK pulse is asserted on
CONVERT and remains asserted based on the selected
pulsewidth, with the added condition that SOC must arrive
before the signal is deasserted. When an external multiplexer
is present, the LOCALMUX_CLK signal can be configured
to pulse only after every n conv ersions, where n is determined
by the value in the 16 bit DIV counter . This is useful when an
external multiplexer is used to switch more than one active
channel into a channel in the scan list. Output polarity is
selectable. Destination: Configuration FIFO. Options: Activ e
Low, A ctive High, Ground, High Z. Related bitfields:
AI_LOCALMUX_CLK_Output_Select,
AI_LOCALMUX_CLK_Pulse,
AI_LOCALMUX_CLK_Pulse_Width,
LOCALMUX_FFRT*O9TUConfiguration FIFO Retransmit—This output indicates that
the configuration FIFO should repeat the scan list. When
MUXFEF is active, the LOCALMUX_FFRT signal is
asserted on the trailing edge of LOCALMUX_CLK and
remains asserted based on the selected pulsewidth. Output
polarity is active low. Destination: Configuration FIFO.
Related bitfields: AI_LOCALMUX_CLK_Pulse_Width.
MUXFEFIUConfiguration FIFO Empty Flag—This input indicates that
the configuration FIFO is empty . The MUXFEF signal is used
to generate the configuration FIFO retransmit signal
(LOCALMUX_FFRT). The input polarity is selectable.
Source: Configuration FIFO. Related bitfields:
AI_FIFO_Flags_Polarity.
SCAN_IN_PROGO4TUScan in Progress—This output indicates that a scan is in
progress. It is useful for generating track/hold signals for on
board track and hold systems in a simultaneous sampling
environment. In the internal CONVERT mode,
SCAN_IN_PROG is asserted when START is recognized. In
the external CONVER T mode, SCAN_IN_PR OG is asserted
on the first CONVERT of each scan. The signal remains
asserted until SOC occurs while the internal STOP is active.
Output polarity is selectable. Destination: Sample and hold
circuit. Options: Active Low, Active High, Ground, High Z.
Related bitfields: AI_SCAN_IN_PROG_Output_Select,
AI_SCAN_IN_PROG_Pulse.
SC_TCO9TUSC Counter TC—This signal indicates the end of a data
acquisition operation. Output polarity is active high. Related
bitfields: Misc_Counter_TCs_Output_Enable.
SHIFTIN*O9TUData Shift Pulse—This output sends ADC data over the serial
link. The serial link transfers data serially across the RT SI bus
but is not currently supported. The signal is similar to
AI_FIFO_SHIFTIN except that its generation is not inhibited
by the GHOST signal. The SHIFTIN pulse is asserted on
EOC and remains asserted based on the selected pulsewidth.
Output polarity is active low. Destination: Serial Data Link.
Related bitfields: AI_SHIFTIN_Pulse_Width.
SI_TCO4TUSI Counter TC Signal—Output polarity is active high.
Related bitfields: Misc_Counter_TCs_Output_Enable.
SOCIUStart of Conversion—This input indicates that a conversion
has begun. Internally , the SOC signal allo ws the trailing edge
of LOCALMUX_CLK to occur, enables the overrun
error-detection circuitry to start the overrun-detection
interval, and terminates the SCAN_IN_PROG signal (when
STOP is asserted). The input polarity is selectable, and the
input state can be directly observed in one of the status
registers. Source: ADC. Related bitfields: AI_SOC_Polarity ,
AI_SOC_St.
National Instruments Corporation2-23DAQ-STC Technical Reference Manual
Page 53
Chapter 2Analog Input Timing/Control
2.6 Programming Information
Programming the DAQ-STC involves writing to and reading from the registers on the chip.
The programming instructions are language independent; that is, they instruct you to write a
value to a given bitfield or register or to detect the state of a bitfield or a register without
presenting the actual code.
This section presents the functions required to implement some common analog input
applications, which are described in pseudocode that refers to the various bitfields. Bitfield
descriptions relevant to the AITM modules are also included. The bitfield descrip tio ns are
intended to be used as a reference. See Appendix B, Register Information, for the DA Q-STC
register map and to locate specific bitfield descriptions in this manual.
A bitfield is a bit in a register, a group of functionally related bits in one register, or a pair of
registers that jointly perform a function. If a bitfield consists of several bits within one
register, the locations of the bits must be contiguous. Pairs of 16-bit registers are needed for
loading and saving the 24-bit counter contents. Each pair of registers is treated as a single
bitfield in this document.
2.6.1 Register and Bitfield Programming Considerations
Several write-only registers on the DAQ-STC contain bitfields that control a number of
functionally independent parts of the chip. To follow the instructions for assigning values to
bitfields, you must set or clear bits without changing the current state of the remaining bits in
the register . Howe v er , writing to these registers af fects all register bits. You cannot read these
registers to determine which bits have been set or cleared in the past; therefore, you should
maintain a software copy of the write-only registers. You can then use this software copy to
determine the status of write-only registers. Because some bitfields get cleared automatically ,
you should keep your software copies current. T o change the state of a single bitfield without
disturbing the remaining bits, perform the following steps:
1.Make a secondary copy of the software copy.
2.Clear the bitfield in the secondary copy.
3.Place the new bitfield value in the secondary copy.
4.Write the value of the secondary copy to the register.
5.If the bitfield is not cleared automatically, update the software copy by replacing it with
secondary copy.
Bitfields that get cleared automatically are called strobe bits. To change the state of a bitfield
that spans over two registers, you need to write to both registers.
All of the write-only and read-only registers on the DAQ-STC can be addressed in two
modes—direct mode and windowed mode. A particular implementation on a board may use
either or both of these modes.
Direct mode allows direct access to all of the D AQ-STC registers. The register addresses are
calculated by adding the register offset to the base address assigned to the DAQ-STC on the
particular board. The Register Maps section of Appendix B, Register Information, lists the
register offsets.
Windowed mode allo ws a smaller address space requirement for the DA Q-STC at the expense
of requiring more accesses to perform the same task. In this mode, all DAQ-STC register
accesses use the Window_Address_Re gister and Window_Data_Register. Refer to the 7.6.1,
Windowed Mode Register Access Example section of Chapter 7, Digital I/O, for more
information on windowing mode and for an example program.
Chapter 2Analog Input Timing/Control
Caution
!
When using windowed-mode accesses from an interruptable process, your
application may not function properly if an interrupt occurs between the time that
the address is loaded into the Window_Address_Register and the time that an
access is made from the Window_Data_Register . Make sure that the interrupt does
not disturb the Window_Address_Register during this sensitive period; disable
interrupts during windowed-mode accesses or write the interrupt routines so that
they do not disturb the contents of the Window_Address_Register.
2.6.3 Programming for an Analog Input Operation
This section contains detailed programming information for bit-level programming of the
AITM for specialized applications. The programs are presented in a bottom-up fashion. This
section lists functions that can be used to configure the AITM for various operations. The
functions are then assembled into a complete program in section 2.6.3.16, Analog Input
Program.
Most of the programming sequences presented here must be executed exactly as shown.
Bitfield assignments are defined as pseudocode instructions of the form <bitfield name> =
<value>. Pseudocode sequences enclosed in braces that contain only bitfield assignments can
normally be executed in any order, or simultaneously, if possible. If the sequence must be
executed in exact order, the character ∑ marks the boundary between two groups of
assignments that have to be ex ecuted sequentially . For example, in the follo wing pseudocode,
the first bitfield assignment must be performed first, the second and third assignments may
then be executed in any order, but the fourth bitfield assignment must be executed after the
second and third bitfield assignments. Other programming constructs, such as if-then, should
be executed in the order shown.
National Instruments Corporation2-25DAQ-STC Technical Reference Manual
Page 55
Chapter 2Analog Input Timing/Control
{
FOUT_Enable = 0;
∑
FOUT_Timebase_Select = 0 (FOUT_IN_TIMEBASE1) or 1 (IN_TIMEBASE2);
FOUT_Divider = 0 (for division factor 16) or 1-15 (for division factor 1-15);
∑
FOUT_Enable = 1;
}
The directives Begin critical section and End critical section mark the beginning and end of
critical sections in the ensuing pseudocode. All statements under these directives must be
synchronized with the ISRs; in other words, while the code fragment under these directives is
executing in the foreground, all interrupt-time-specific code must be prevented from
executing in the background.
Under some single-tasking operating systems such as DOS, the directives Begin critical section and End critical section directly map to CLI and STI assembly-language instructions,
respectively . Ho wever , other operating systems may require specific primiti ves to achie ve this
functionality.
2.6.3.1 Resetting
Assume the AITM was set up to perform an unknown operation. The object is to stop any
activities in progress.
AI_Board_Personalize function to bring the AITM into a known
state. You can then program the AITM for any desired operation.
2.6.3.2 Board Power-up Initialization
Part of the AITM programming depends only on properties of the hardware surrounding the
DA Q-STC. If you are programming a D AQ-STC that is part of a data acquisition system, refer
to the document for register-level programming for information about the proper selections to
make in this function.
Function
{
AI_Board_Personalize
Begin critical section;
AI_Configuration_Start = 1;
∑
AI_Source_Divide_By_2 = 0 (AI_IN_TIMEBASE1 equals IN_TIMEBASE) or
1 (AI_IN_TIMEBASE1 is IN_TIMEBASE divided by two);
AI_Output_Divide_By_2 = 0 (AI_OUT_TIMEBASE equals IN_TIMEBASE) or
1 (AI_OUT_TIMEBASE is IN_TIMEBASE divided by
two);
AI_CONVERT_Pulse_Timebase = 0 (pulsewidth is selected by
AI_AIFREQ_Polarity = 0 (active high) or 1 (active low);
AI_SC_TC_Output_Select = 0 (high Z) or 1 (ground) or 2 (enable, active low) or 3
(enable, active high);
AI_SHIFTIN_Polarity = 0 (active low) or 1 (active high);
AI_SHIFTIN_Pulse_Width = 0 (0.5–1.5 AI_OUT_TIMEBASE periods) or
AI_EOC_Polarity = 0 (rising edge) or 1 (falling edge);
AI_SOC_Polarity = 0 (rising edge) or 1 (falling edge);
1 (0.5–1 AI_OUT_TIMEBASE periods);
3 (enable, active high);
periods, Read = 1.5–2 AI_OUT_TIMEBASE periods) or
1 (Retransmit = 0.5 AI output clock periods,
Read = 0.5–1 AI_OUT_TIMEBASE periods);
1 (1.5–2 AI_OUT_TIMEBASE periods);
AI_Overrun_Mode = 0 (from SOC to EOC) or 1 (from SOC to the trailing edge of
SHIFTIN);
AI_SCAN_IN_PROG Output_Select = 0 (high Z) or 1 (ground) or 2 (enable, active low)
AI_LOCALMUX_CLK_Output_Select = 0 (high Z) or 1 (ground) or 2 (enable, active
∑
AI_Configuration_End = 1;
End critical section;
}
2.6.3.3 Initialize Configuration Memory Output
Use this function to generate a LOCALMUX_CLK pulse that accesses the first value in the
configuration FIFO.
Function
{
DAQ-STC Technical Reference Manual2-28
AI_Initialize_Configuration_Memory_Output
Begin critical section;
AI_Configuration_Start = 1;
If (an external MUX is present) then
{
/*Pause here long enough that the LOCALMUX_CLK pulse generated by the /
/*CONVERT* will have time to clock the configuration FIFO*/
AI_External_MUX_Present = 1;
}
Else
{
AI_CONVERT_Pulse = 1;
}
AI_Configuration_End = 1;
End critical section;
}
2.6.3.4 Board Environment Setup
Part of the AITM programming depends only on properties of hardware surrounding the
device that the DAQ-STC is on. For example, if you have an MIO board, the external
hardware can be an AMUX-64T or an SCXI device. The major distinction between po wer-up
initialization and environment setup is that power-up initialization is always the same for a
device using the DAQ-STC, while the latter environmental setup may be different.
Function
AI_Board_Environmentalize
{
Begin critical section;
AI_Configuration_Start = 1;
∑
If (an external MUX is present) then
{
AI_EXTMUX_CLK_Output_Select = 2 (enable, active low) or 3 (enable, active high);
/*Base selection on board hardware*/
AI_EXTMUX_CLK_Pulse_Width = 0 (4.5 AI_OUT_TIMEBASE periods) or
1 (same as LOCALMUX_CLK);
If (more than one external MUX channel corresponds to each internal channel) then
{
AI_External_MUX_Present = 1;
∑
AI_DIV_Load_A = number of external channels corresponding to each internal
channel - 1;
National Instruments Corporation2-29DAQ-STC Technical Reference Manual
Page 59
Chapter 2Analog Input Timing/Control
}
}
Else
{
AI_External_MUX_Present = 0;
AI_EXTMUX_CLK_Output_Select = 0 (high Z) or 1 (forced to logic low);
∑
AI_Configuration_End = 1;
End critical section;
}
If AI_External_MUX_Present is set to 1, you should use the DIV counter to account for the
external-to-internal multiplexing factor. In this case, you cannot use the DIV counter to
generate the STOP trigger.
2.6.3.5 FIFO Request
Use this function to select the data FIFO condition on which interrupt or DMA requests will
be generated.
/*Base selection on board hardware*/
Function
FIFO_Request_Selection
{
Begin critical section;
AI_Configuration_Start = 1;
∑
AI_FIFO_Mode = 0 (FIFO not empty) or 1 (FIFO half-full) or 2 (FIFO full) or
3 (FIFO half-full until FIFO empty);
∑
AI_Configuration_End = 1;
End critical section;
}
2.6.3.6 Hardware Gate Programming
Use this function to enable or disable hardware and software gating. If you enable hardware
gating, you also select the signal that controls the gate, the gate polarity , and the gating mode.
Function
{
AI_Hardware_Gating
Begin critical section;
∑
AI_Configuration_Start = 1;
If (external gating is desired) then
{
In order to use the software gate, the hardware gate must also be enabled. If you want to use
both the software and hardware gate at the same time, configure the hardware gate and then
start your application. If you only want to use the software gate, configure the hardware gate
as indicated in section 2.6.3.6, Hardware Gate Programming with the following changes to
the settings:
•AI_External_+Gate_Select = 31;
•AI_External_Gate_Polarity = 1;
Note
The hardware gate must be enabled in order for the software gate to operate
properly.
To use the software gate, issue the following commands:
•To pause analog input:
AI_Software_Gate = 1;
•To resume analog input after pause:
AI_Software_Gate = 0;
Notes
Software and external gating share the gating mode; that is,
AI_External_Gate_Mode determines the mode of operation for both hardware
and software gating.
Software and hardware gating can be used simultaneously without any special
setup. The analog input operation proceeds when neither hardware nor software
gate is in the pause state.
/*Trigger Selection*/
AI_START1_Select = 0 (bitfield AI_START1_Pulse) or 1 through 10 (PFI<0..9>)
If (AI_START1_Select is 0) then
{
AI_START1_Polarity = 0;
AI_START1_Edge = 1;
AI_START1_Sync = 1;
}
Else
{
AI_START1_Polarity = 0 (active high or rising edge) or
AI_START1_Edge = 1;
AI_START1_Sync = 1;
}
}
∑
AI_Configuration_End = 1;
End critical section;
}
Chapter 2Analog Input Timing/Control
or 11 through 17 (RTSI_TRIGGER<0..6>) or
18 (the G_OUT signal from general-purpose counter 0);
1 (active low or falling edge);
2.6.3.9 Number of Scans
Use this function to select the number of scans to be acquired. In a staged acquisition, the
number of scans to be executed in each stage is contained in an array named
the acquisition is staged, this function will load the initial value of
sc_ticks into the SC load
register to initialize the first stage. The additional values in the array are written as needed by
the interrupt routine (see
Function
AI_Number_Of_Scans
AI_Staged_ISR).
{
Begin critical section;
AI_Configuration_Start = 1;
AI_SC_Reload_Mode = 0 (same load register);
}
AI_SC_Load_A = number of posttrigger scans to acquire - 1;
∑
AI_SC_Load = 1;
If (staged acquisition) then
{
AI_SC_Load_B =
∑
AI_SC_Reload_Mode = 0;
∑
AI_SC_Switch_Load_On_TC = 1;
}
∑
AI_Configuration_End = 1;
End critical section;
}
sc_ticks[0] - 1;
2.6.3.10 Start of Scan
Use this function to select the scan start event. You can specify the scan rate by choosing an
internally generated periodic signal to be the START signal. In a staged acquisition, the
number of clocks between START in each stage is contained in an array named
If the acquisition is staged, this function loads the initial value of
register to initialize the first stage. The additional values in the array are written as needed by
the interrupt routine (see
Variable
si_last_load_register introduced in this function will be used later in the
functions for changing the scan rate during an acquisition (
staged acquisition (
Function
AI_Scan_Start
{
Begin critical section;
Declare variable
AI_Configuration_Start = 1;
AI_SI_Special_Trigger_Delay = 0;
AI_START_Select = 0 (the internal signal SI_TC);
AI_START_Edge = 1;
AI_START_Sync = 1;
AI_START_Polarity = 0;
If (SI counter will use an internal timebase) then
{
AI_SI_Source_Select = 0 (AI_IN_TIMEBASE1) or 19 (IN_TIMEBASE2);
AI_SI_Source_Polarity = 0;
}
Else
{
AI_SI_Source_Select = 1 through 10 (PFI<0..9>) or 11 through 17
(RTSI_TRIGGER<0..6>);
AI_SI_Source_Polarity = 0 (rising edge) or 1 (falling edge);
}
If (acquisition is retriggerable) then
{
/*You can specify a special delay from the START1 trigger to the first start of
scan by preloading SI*/
AI_SI_Load_A = (number of clocks from START1 to first START) - 1;
AI_SI_Initial_Load_Source = 0;
∑
AI_SI_Load = 1;
∑
AI_SI_Load_A = number of clocks between each START - 1;
AI_SI_Reload_Mode = 0;
}
Else if (you will not change the scan rate during the acquisition) then
{
/*You can specify a special delay from the START1 trigger to the first start of */
/*a scan by using reload mode*/
AI_SI_Load_B = number of clocks from START1 to first START - 1;
AI_SI_Load_A = number of clocks between each START - 1;
AI_SI_Initial_Load_Source = 1;
∑
AI_SI_Load = 1;
∑
AI_SI_Initial_Load_Source = 0;
AI_SI_Reload_Mode = 6 (alternate first period on every SC_TC);
}
Else
{
/*Interval from the START1 trigger to the first start of scan is equal to the scan
interval*/
AI_SI_Load_A = number of clocks between each START - 1;
AI_SI_Source_Select = 1 through 10 (PFI<0..9>) or 11 through 17
(RTSI_TRIGGER<0..6>);
AI_SI_Source_Polarity = 0 (rising edge) or 1 (falling edge);
si_ticks[0] - 1;
2.6.3.11 End of Scan
Use this function to select the end-of-scan event. On a typical MIO board, the end-of-scan
event comes from the configuration memory. On a typical board without configuration
memory, the end-of-scan event is generated by the DIV counter. Notice that the DAQ-STC
cannot simultaneously generate end-of-scan events and timing for an external signal
multiplexer.
National Instruments Corporation2-37DAQ-STC Technical Reference Manual
AI_Scan_End
Begin critical section;
AI_Configuration_Start = 1;
∑
If (the end of scan is coming from the outside, either PFI or Configuration FIFO) then
{
Page 67
Chapter 2Analog Input Timing/Control
AI_STOP_Select = 1 through 10 (PFI<0..9>) or 11 through 17
(RTSI_TRIGGER<0..6>) or 19 (signal present on the AI_STOP_IN pin);
AI_STOP_Edge = 0;
AI_STOP_Polarity = 0 (active high or rising edge) or 1 (active low or falling edge);
AI_STOP_Sync = 1;
/*If you have a vary fast board, you may need to use an asynchronous STOP
(AI_STOP_Sync = 0)*/
}
Else
{
If (more than one channel per scan) then
{
/*DIV counter is used as the STOP source*/
AI_STOP_Select = 0 (DIV_TC);
AI_STOP_Sync = 1;
AI_STOP_Edge = 0;
AI_STOP_Polarity = 0;
AI_DIV_Load_A = number of channels per scan - 1;
∑
AI_DIV_Load = 1;
}
Else
{
/*Force START signal to be always high*/
AI_STOP_Select = 31 (logic low);
AI_STOP_Sync = 0;
AI_STOP_Edge = 0;
AI_STOP_Polarity = 1;
}
}
∑
AI_Configuration_End = 1;
End critical section;
}
2.6.3.12 Convert Signal
Use this function to select the CONVERT signal. You can specify the channel rate by
choosing an internally generated periodic event.
Function
{
DAQ-STC Technical Reference Manual2-38
AI_CONVERT_Signal
Begin critical section;
AI_Configuration_Start = 1;
AI_SC_Gate_Enable = 0;
AI_Start_Stop_Gate_Enable = 0;
If (SI2 counter will use internal time) then
{
/*If you want both SI and SI2 to use AI_IN_TIMEBASE1, you must program
SI to select*/
/*AI_IN_TIMEBASE1 and program SI2 to select the SI source*/
If (SI2 will use AI_IN_TIMEBASE1) then
{
If (internal START mode) AND (SI will use AI_IN_TIMEBASE1) then
AI_SI2_Source_Select = 0 (same signal selected as SI source);
/*If you want SI2 to use IN_TIMEBASE2, program the SI2 counter to */
/*use the same timebase as the SI counter, and then program the SI */
/*counter to use IN_TIMEBASE2. This will work well in one of the */
/*following two cases: you are not using SI at all, or you are using */
/*SI and it uses IN_TIMEBASE2*/
AI_SI2_Source_Select = 0 (same signal selected as SI source);
AI_SI_Source_Select = 19 (IN_TIMEBASE2);
AI_SI_Source_Polarity = 0;
}
}
Else
{
/*You want to use SI2 and you want to use one of the external timebases. */
/*Program the SI2 counter to use the same timebase as the SI counter, */
/*and program the SI counter to use the external timebase of your choice. */
/*This will work well in one of the following are not using SI at all, or you*/
/*are using SI and it uses the timebase you have selected here*/
AI_SI2_Source_Select = 0 (same signal selected as SI source);
AI_SI_Source_Select = 1 through 10 (PFI<0..9>) or
11 through 17 (RTSI_TRIGGER<0..6>);
AI_SI_Source_Polarity = 0 (rising edge) or 1 (falling edge);
}
AI_SI2_Load_A = number of clocks from START to the first CONVERT - 1;
AI_SI2_Initial_Load_Source = 0;
AI_SI2_Load_B = number of clocks between two CONVERT signals within
a scan - 1;
AI_SI2_Reload_Mode = 1 (alternate first period on every STOP);
National Instruments Corporation2-39DAQ-STC Technical Reference Manual
Page 69
Chapter 2Analog Input Timing/Control
}
Else
{
AI_SC_Gate_Enable = 1;
AI_Start_Stop_Gate_Enable = 1;
AI_CONVERT_Source_Select = 1 through 10 (PFI<0..9>) or
AI_CONVERT_Source_Polarity = 0 (falling edge) or 1 (rising edge);
}
∑
AI_Configuration_End = 1;
End critical section;
}
Another feature the DAQ-STC provides in the external CONVERT mode is SC_GATE
(SC Counter Gate). Similar to the STST_GATE, the SC_GATE provides a mechanism for
blocking the external CONVER T pulses. If you set AI_Start_Stop_Gate_Enable to 0 in the
external CONVERT section of the
selected. The SC_GATE enables the external CONVERT pulses whenever the SC counter is
enabled to count and blocks the external CONVERT pulses whenever the SC counter is not
enabled to count.
11 through 17 (RTSI_TRIGGER<0..6>) or
19 (the G_OUT signal from general-purpose counter 0);
AI_Convert_Signal function, the SC_GATE is
2.6.3.13 Enable Interrupts
Use this function to enable the AITM to generate interrupts.
Function
{
}
DAQ-STC Technical Reference Manual2-40
AI_Interrupt_Enable
AI_FIFO_Interrupt_Enable = 0 (disabled) or 1 (enabled);
AI_START_Interrupt_Enable = 0 (disabled) or 1 (enabled);
/*START interrupt must be enabled in order for the STOP interrupt to operate*/
If (AI_START_Interrupt_Enable is 1) then
{
AI_STOP_Interrupt_Enable = 0 (disabled) or 1 (enabled);
}
Else
{
AI_STOP_Interrupt_Enable = 0 (disabled);
}
AI_SC_TC_Interrupt_Enable = 0 (disabled) or 1 (enabled);
AI_START1_Interrupt_Enable = 0 (disabled) or 1 (enabled);
AI_START2_Interrupt_Enable = 0 (disabled) or 1 (enabled);
AI_Error_Interrupt_Enable = 0 (disabled) or 1 (enabled);
To generate interrupts, you must also program the interrupt control module. Refer to
Chapter 8, Interrupt Control, for more information on programming the interrupt control
module. To use interrupts, refer also to section 2.6.8, Analog Input-Related Interrupts.
2.6.3.14 Arming
Use this function to arm the analog input counters.
Function
AI_Arming
{
Declare variable
arm_si, arm_si2
;
If (single scan) then
{
AI_DIV_Arm = 1;
AI_End_On_End_Of_Scan = 1;
}
If (internal START mode) OR (SI special trigger delay will be used) then
arm_si = 1;
Else
arm_si = 0;
If (internal CONVERT mode) then
arm_si2 = 1;
Else
arm_si2 = 0;
AI_SC_Arm = 1;/*You must set these four bitfields in a single write*/
AI_SI_Arm =
AI_SI2_Arm =
arm_si;
arm_si2;
AI_DIV_Arm = 1;
}
2.6.3.15 Starting the Acquisition
Use this function to initiate an analog input operation if you have selected software pretrigger
(for pretriggered operation) or software posttrigger (for non-pretriggered operation). This
function does not do anything unless you have selected software pretrigger or posttrigger.
National Instruments Corporation2-41DAQ-STC Technical Reference Manual
Page 71
Chapter 2Analog Input Timing/Control
If (software posttrigger) then
AI_START1_Pulse = 1;
}
}
2.6.3.16 Analog Input Program
The previous sections listed functions that you can use to configure the AITM. This section
shows how to organize these functions to implement a general analog input operation. You
can use the following sequence of functions to program the AITM for any analog input
operation.
{
/*Refer to Chapter 10, Miscellaneous Functions, to set up your timebase*/
/*Before beginning the programming sequence, you may want to program the */
/*Configuration FIFO and flush the AI data FIFO, if this is appropriate for your DAQ */
/*device*/
Call
/*You may want to clear the AI data FIFO, if applicable. If you are using an external */
/*multiplexer, such as the AMUX-64T, you must program it here*/
/*If you are using an external track-and-hold module that requires the presence of the
/*SCAN_IN_PROG signal on PFI7, you must program it here*/
Call
AI_Interrupt_Enable;
Call
AI_Arming;
Call
AI_Start_The_Acquisition;
}
;
2.6.4 Single Scan
T o acquire exactly one scan of input, a special programming sequence is required, as follows.
{
Use the programming sequence from section 2.6.3.16, Analog Input Program.
In the function
After the programming sequence is complete, issue the following commands:
AI_START_Polarity = 1;
∑
AI_START_Polarity = 0;
}
2.6.5 Change Scan Rate during an Acquisition
You can change the scan rate if you do not have special requirements on the timing for the
ST AR T1 to START in retriggerable analog input or if the acquisition is not retriggerable. This
will not work in the case of retriggerable analog input with nondefault START1 to START
timing. Assume that the sequence of START rates is stored in the array
variable
following function to change the scan rate.
si_ticks_pointer indicates the current position in the array. You can use the
Chapter 2Analog Input Timing/Control
si_ticks, and the
Function
AI_Scan_Rate_Change
{
If (acquisition is not retriggerable) OR (you will change the scan rate during an
acquisition) then
{
If (
si_last_load_register is 0) then
{
/*If the last load was from the last load register written to, it is all right to */
/*change the rate Otherwise, you cannot change the rate*/
National Instruments Corporation2-43DAQ-STC Technical Reference Manual
Page 73
Chapter 2Analog Input Timing/Control
Else
AI_SI_Switch_Load_On_SC_TC = 1;
}
Else
Scan rate change cannot be performed;
}
}
}
2.6.6 Staged Acquisition
In a staged acquisition, software implements more than one posttrigger acquisition sequence,
each having unique timing parameters. The number of scans to be executed in each stage is
contained in an array named
the array and should be initialized to 1. The number of scans for the first two posttrigger
acquisition sequences is programmed in the
The number of clocks between START in each stage is contained in an array named
si_ticks. The variable si_ticks_pointer is a pointer into the array and should be
initialized to 1. The number of clocks for the first two posttrigger acquisition sequences is
programmed in the
AI_Scan_Start function.
sc_ticks. The variable sc_ticks_pointer is a pointer into
AI_Number_Of_Scans function.
The variable
recently and is initialized in the
si_last_load_register indicates which load register was accessed most
AI_Scan_Start function.
The SC_TC interrupt notifies the CPU that the current acquisition sequence is complete so
that the ISR can program the parameters for the next acquisition sequence. After the
parameters are loaded, the ISR checks for an SC_TC error. An SC_TC error occurs if the
parameters for the next acquisition sequence are not written before the end of the current
acquisition sequence.
Use the following function as an ISR for staged acquisitions.
Function
AI_Staged_ISR
{
/*If the last load was from the last load register written to, it is all right to change the */
/*rate. Otherwise, you cannot change the rate*/
If (
}
AI_SC_TC_Interrupt_Ack = 1;
/*Check for interrupt latency problems*/
If (AI_SC_TC_Error_St is 0) then
{
AI_SC_TC_Error_Confirm = 1;
}
Else
{
Inform user that an SC_TC error has occurred;
}
}
Chapter 2Analog Input Timing/Control
2.6.7 Master/Slave Operation Considerations
You can use several DAQ-STCs for synchronized analog input operation. T o do this, connect
the trigger signal to the trigger input of the master DAQ-STC. You also connect the output
equivalents of the triggers from the master DAQ-STC to the sla ve DAQ-STCs. You may use
the RTSI connector to do this.
National Instruments Corporation2-45DAQ-STC Technical Reference Manual
You must perform the programming sequence described in section 10.8.1,
Programming Clock Distribution, before you execute the sequence given here.
Page 75
Chapter 2Analog Input Timing/Control
Use the following programming sequence:
{
AI_START1_Disable = 1 for the master DAQ-STC;
AI_Delayed_START1 = 1 for the master DAQ-STC;
AI_Delayed_START1 = 0 for all the slave DAQ-STCs;
If (pretriggered AI) then
{
AI_Delayed_START2 = 1 for the master DAQ-STC;
AI_Delayed_START2 = 0 for all the slave DAQ-STCs;
}
Perform the usual set-up sequence for each DAQ-STC;
/*See programming sequence in Analog Input Program*/
AI_START1_Disable = 0 for the master DAQ-STC;
}
2.6.8 Analog Input-Related Interrupts
The DAQ-STC is designed to be used primarily with a system that supports interrupts. This
section contains instructions on programming the DAQ-STC when it is used in an
environment that supports interrupts.
If the DA Q-STC you want to program is part of a system in which interrupts do not exist, you
can use programming sequences intended for ISRs directly in your application, coupled with
the programming technique known as polling. If you use polling, your application must
periodically read relevant status bitfields and use the values obtained to decide whether to
execute a programming sequence equivalent to the ISRs.
When the DA Q-STC is used in a system in which interrupts can be handled, b ut the handling
is prohibitively slow, you can use the polling technique. However, your system will be
devoted entirely to one application.
For more detailed discussion of interrupts and polling, refer to any introductory computer
architecture textbook. Information on interrupts and polling can also be found in National
Instruments Application Note 010: Prog ramming Interrupts for Data Acquisition on 80x86-Based Computers.
Interrupts related to analog input can be generated on the following analog input conditions:
National Instruments Corporation2-47DAQ-STC Technical Reference Manual
Page 77
Chapter 2Analog Input Timing/Control
To clear:You must change the FIFO state by dealing with the
FIFO
All interrupts related to analog input are in interrupt group A.
To select the interrupt line to be used,
Interrupt_A_Output_Select = 0 through 7;
Interrupt_A_Enable = 1;
To determine quickly if any of the group A interrupts have occurred, use Interrupt_A_St.
NotesTo select interrupt output polari ty, use Interrupt_Output_Polarity. This selection
depends on the board hardware design.
Pass_Through_0_Interrupt is also in interrupt group A.
For more detailed information about the conditions that generate an interrupt, refer to
section 2.8.4, Interrupt Control.
2.6.9 Bitfield Descriptions
Bits in the register bit maps are organized into bitfields. A bitfield can contain one or more
bits. Only bits with contiguous locations within a register can belong to a bitfield. The high
and low pairs of load and save registers for 24-bit counters are also treated as bitfields. The
AITM-related bitfields are described below. Not all bitfields referred to in section 2.6,
Programming Information, are listed here. To locate a particular bitfield description within
this manual, refer to Appendix B, Register Information.
AI_AIFREQ_Polarity
bit: 4type: Writein: AI_Personal_Registeraddress: 77
This bit selects the polarity of the AIFREQ output signal:
0: Active high.
1: Active low.
AI_Analog_Trigger_Reset
bit: 14type: Strobein: AI_Command_1_Registeraddress: 8
This bit clears the hysteresis registers in the analog trigger circuit. Set this bit to 1 at the time
you arm the analog input counters if you want to use analog triggering in hysteresis mode for
any analog input signal. Before setting this bit to 1, make sure that the analog trigger is not
being used by any other part of the DAQ-STC. You should not set this bit to 1 in any other
case. This bit is cleared automatically.
bit: 8type: Strobein: Joint_Reset_Registeraddress: 72
This bit clears AI_Configuration_Start, which holds the analog input circuitry in reset to
prevent glitches on the output pins during configuration. You should set this bit to 1 when
ending the configuration of the analog input circuitry. This bit is cleared automatically.
Related bitfields: AI_Configuration_Start.
AI_Configuration_Start
bit: 4type: Strobein: Joint_Reset_Registeraddress: 72
This bit holds the analog input circuitry in reset to prevent glitches on the output pins during
configuration. The following analog input circuits are affected:
• Output circuits
• Counter control circuits
• Trigger circuits
• Interrupt circuits
The following circuits are also affected:
• Interrupt_A_Ack_Register
• Autoacknowledge circuit for general-purpose counter 0.
You should set this bit to 1 when beginning the configuration of the analog input circuitry.
By doing this you ensure that no spurious glitches appear on the output pins and on the
internal circuit components. If you do not set this bit to 1, the DAQ-STC may behave
erroneously. This bit is cleared by setting AI_Configuration_End to 1. Related bitfields:
AI_Configuration_End.
AI_Config_Memory_Empty_St
bit: 6type: Readin: Joint_Status_2_Registeraddress: 29
This bit indicates the state of the MUXFEF input pin (after the polarity selection). Related
bitfields: AI_FIFO_Flags_Polarity.
AI_Continuous
bit: 1type: Writein: AI_Mod e_1_ Registeraddress: 12
This bit determines the behavior of the SC, SI, SI2, and DIV counters during SC_TC:
0: If AI_Pre_Trigger is 0, the counters will return to idle on the first SC_TC. If
AI_Pre_Trigger is 1, the counters will return to idle on the second SC_TC.
1: The counters will ignore SC_TC.
Set this bit to 0 to select the pretrigger or posttrigger acquisition modes if you want to acquire
a predetermined number of scans. Set this bit to 1 to select the continuous acquisition mode
if you wish to continuously acquire data or to perform staged analog input. You can use
AI_End_On_End_Of_Scan and AI_End_On_SC_TC to stop an analog input operation in the
continuous acquisition mode. Related bitfields: AI_End_On_End_Of_Scan,
AI_End_On_SC_TC, AI_Pre_Trigger.
National Instruments Corporation2-49DAQ-STC Technical Reference Manual
Page 79
Chapter 2Analog Input Timing/Control
AI_CONVERT_Original_Pulse
bit: 9type: Writein: AI_Personal_Registeraddress: 77
If AI_CONVERT_Pulse_Timebase is 1, this bit determines the pulsewidth of the CONVERT
and PFI2/CONV signals. The pulsewidth of the CONVERT signals is:
0: Equal to the pulsewidth of the signal used to generate the CONVERT signal, with
the maximum pulsewidth determined by AI_CONVERT_Pulse_Width.
1: Equal to the pulsewidth of the signal used to generate the CONVERT signal.
Related bitfields: AI_CONVERT_Pulse_Timebase, AI_CONVERT_Pulse_Width.
AI_CONVERT_Output_Select
bits: <0..1>type: Writein: AI_Output_Control_Reg isteraddress: 60
This bit enables and selects the polarity of the CONVERT output signal:
0: High Z.
1: Ground.
2: Enable, active low.
3: Enable, active high.
This bitfield also selects the polarity of the PFI2/CONV output signal, if enabled for output:
0: Active low.
1: Ground.
2: Active low.
3: Active high.
Related bitfields: BD_2_Pin_Dir.
AI_CONVERT_Pulse
bit: 0type: Strobein: AI_Command_1_Registeraddress: 8
Setting this bit to 1 produces a pulse on the CONVERT and PFI2/CONV output signals, if the
signals are enabled for output and if CONVERT pulses are not blocked. CONVERT pulses
can be blocked by the external gate, the software gate, the start/stop gate, or the SC gate. The
pulsewidths of the output signals are determined by AI_CONVERT_Pulse_Width. This bit is
cleared automatically. This bit is disabled when AI_Configuration_Start is set to 1. Related
bitfields: AI_CONVERT_Output_Select, BD_2_Pin_Dir, AI_CONVERT_Pulse_Width.
AI_CONVERT_Pulse_Timebase
bit: 11type: Writein: AI_Personal_Registeraddress: 77
This bit determines how the pulsewidths of the CONVERT and PFI2/CONV signals are
selected:
0: Selected by AI_CONVERT_Pulse_Width.
1: Selected by AI_CONVERT_Original_Pulse.
Related bitfields: AI_CONVERT_Pulse_Width, AI_CONVERT_Original_Pulse.
bit: 10type: Writein: AI_Personal_Registeraddress: 77
If AI_CONVERT_Pulse_Timebase is 0, this bit determines the pulsewidth of the CONVERT
and PFI2/CONV output signals. If AI_CONVERT_Pulse_Timebase is 1 and
AI_CONVERT_Original_Pulse is 0, this bit determines the maximal pulsewidth of the
CONVERT and PFI2/CONV signals (so that the pulsewidth is equal to the shorter of this
pulsewidth and the original signal pulsewidth). The pulsewidths are as follows:
Related bitfields: AI_CONVERT_Pulse_Timebase, AI_CONVERT_Original_Pulse.
AI_CONVERT_Source_Polarity
bit: 5type: Writein: AI_Mod e_1_ Registeraddress: 12
This bit selects the of active edge of the CONVERT source (the signal that is selected by
AI_CONVERT_Source_Select):
0: Falling edge.
1: Rising edge.
You must set this bit to 0 in the internal CONVERT mode. Related bitfields:
AI_CONVERT_Source_Select.
AI_CONVERT_Source_Select
bits: <11..15>type: Writein: AI_Mode_1_Registeraddress: 12
This bitfield selects the CONVERT source:
0: The internal signal SI2_TC, inverted..
1–0: PFI<0..9>.
11–17: RTSI_TRIGGER<0..6>.
19: The internal signal GOUT from general-purpose counter 0.
31: Logic low.
When you set this bit to 0, the DAQ-STC is in the internal CONVERT mode. When you select
any other signal as the CONVERT source, the DAQ-STC is in the external CONVERT mode.
AI_Delayed_START
bit: 9type: Writein: AI_Mod e_3_ Registeraddress: 87
This bit determines when the START1 trigger is used by the AITM:
0: Use START1 trigger immediately.
1: Delay the START1 trigger by synchronizing it to the CONVERT source.
Set this bit to 1 in the master ASIC during master/slave trigger. The slave ASIC(s) can then
synchronize to the same clock as the master by triggering on the START1 signal that is output
from the master.
National Instruments Corporation2-51DAQ-STC Technical Reference Manual
Page 81
Chapter 2Analog Input Timing/Control
AI_Delayed_START2
bit: 10type: Writein: AI_Mode_3_Registeraddress: 87
This bit determines when the START2 trigger is used by the AITM:
0: Use START2 trigger immediately.
1: Delay the START2 trigger by synchronizing it to the CONVERT source.
Set this bit to 1 in the master ASIC during master/slave trigger. The slave ASIC can then
synchronize to the same clock as the master by triggering on the START2 signal that is output
from the master.
AI_Delay_START
bit: 14type: Writein: AI_Mode_3_Registeraddress: 87
This bit selects the internal clock that synchronizes the START trigger when START
synchronization is selected:
0: START synchronizes to SI2_SRC (internal CONVERT) or to FSCLK (external
CONVERT).
1: START synchronizes to SC_SRC.
Since the clock SC_SRC is internally delayed relative to SI2_SRC and FSCLK, setting this
bit to 1 provides additional margin for the external START to reach the synchronization
flip-flop, but allows less margin for the output of the synchronization flip-flop to reach the
counter control circuits. You should normally set this bit to 0.
Related bitfields: AI_START_Sync.
AI_Disarm
bit: 13type: Strobein: AI_Command_1_Registeraddress: 8
Setting this bit to 1 asynchronously disarms the SC, SI, SI2, and DIV counters. This command
should only be used to disarm idle counters. To disarm non-idle counters, use
AI_Software_Reset. This bit is cleared automatically.
Related bitfields: AI_Software_Reset.
AI_DIV_Arm
bit: 8type: Strobein: AI_Command_1_Registeraddress: 8
This bit arms the DIV counter. The counter remains armed (and the bit remains set) until it is
disarmed, either by hardware or by setting AI_Disarm to 1. Related bitfields:
AI_DIV_Armed_St, AI_Disarm.
bit: 14type: Readin: AI_Status_2_Registeraddress: 5
This bit indicates whether the DIV counter is armed:
0: Disarmed.
1: Armed.
Related bitfields: AI_DIV_Arm.
AI_DIV_Load
bit: 7type: Strobein: AI_Command_1_Registeraddress: 8
If the DIV counter is disarmed, this bit loads the DIV counter with the contents of the DIV
load register. If the DIV counter is armed, writing to this bit has no effect. This bit is cleared
automatically.
AI_DIV_Load_A
bits: <0..15>type: Writein: AI_DIV_Load_A_Registeraddress: 64
This bitfield is the load register for the DIV counter. The DIV counter loads the value
contained in this bitfield on AI_DIV_Load and on DIV_TC. Related Bitfields:
AI_DIV_Load.
AI_DIV_Q_St
bit: 13type: Readin: AI_Status_2_Registeraddress: 5
This bit reflects the state of the DIV control circuit:
0: WAIT.
1: CNT.
See section 2.8, Detailed Description, for more information on the DIV control circuit.
AI_DIV_Save_Value
bits: <0..15>type: Readin: AI_DIV_Save_Registeraddress: 26
This bitfield reflects the contents of the DIV counter. Reading from this bitfield while the DIV
counter is counting may result in an erroneous value.
AI_End_On_End_Of_Scan
bit: 14type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 disarms the SC, SI, SI2, and DIV counters at the next STOP. You can use
this bit to stop the acquisition in continuous acquisition mode. This bit is cleared
automatically. Related bitfields: AI_Continuous.
National Instruments Corporation2-53DAQ-STC Technical Reference Manual
Page 83
Chapter 2Analog Input Timing/Control
AI_End_On_SC_TC
bit: 15type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 disarms the SC, SI, SI2, and DIV counters at the next SC_TC. You can
use this bit to stop the acquisition in continuous acquisition mode. This bit is cleared
automatically. Related bitfields: AI_Continuous.
AI_EOC_Polarity
bit: 14type: Writein: AI_Personal_Registeraddress: 77
This bit determines which edge of the EOC input signal indicates end of conversion:
0: Rising edge.
1: Falling edge.
Related bitfields: AI_EOC_St.
AI_EOC_St
bit: 4type: Readin: Joint_Status_2_R egisteraddress: 29
This bit indicates the state of the EOC pin (after the polarity selection). This bit is useful for
device diagnostic applications. Related bitfields: AI_EOC_Polarity.
AI_Error_Interrupt_Ack
bit: 13type: Strobein: Interrupt_A_Ack_ Registeraddress: 2
Setting this bit to 1 clears AI_Overflow_St and AI_Overrun_St and acknowledges the Error
interrupt request (in either interrupt bank) if the Error interrupt is enabled. This bit is cleared
automatically. Related bitfields: AI_Overflow_St, AI_Overrun_St,
AI_Error_Interrupt_Enable.
AI_Error_Interrupt_Enable
bit: 5type: Writein: In terrupt_A_Enable_Registeraddress: 73
This bit enables the Error interrupt:
0: Disabled.
1: Enabled.
The Error interrupt is generated on the detection of an overrun or overflow error condition.
AI_Error_Second_Irq_Enable
bit: 5type: Writein: Second_ Irq_A_ E nable_Registeraddress: 74
This bit enables the Error interrupt in the secondary interrupt bank:
0: Disabled.
1: Enabled.
The Error interrupt is generated on the detection of an overrun or overflow error condition.
bit: 8type: Writein: AI_Mod e_3_ Registeraddress: 87
This bit determines the gating mode, if gating is enabled.
0: Free-run gating mode.
1: Halt-gating mode.
Refer to section 2.4.4, Gating, for more information on gating modes. Related bitfields:
AI_External_Gate_Select, AI_Software_Gate.
AI_External_Gate_Polarity
bit: 5type: Writein: AI_Mod e_3_ Registeraddress: 87
This bit selects the polarity of the external gate signal:
0: Active high (high enables operation).
1: Active low (low enables operation).
AI_External_Gate_Select
bits: <0..4>type: Writein: AI_Mode_3_Registeraddress: 87
This bitfield enables and selects the external gate:
0: External gate disabled.
1–10: PFI<0..9>.
11–17: RTSI_TRIGGER<0..6>.
31: Logic low.
You can use the external gate to pause an analog input operation in progress. Refer to
section 2.4.4, Gating, for more information on external gating. Related bitfields:
AI_External_Gate_Polarity.
AI_External_Gate_St
bit: 10type: Readin: Joint_Status_1_Registeraddress: 27
This bit indicates whether the external gate and the software gate are set to enable analog
input operation:
0: Pause analog input operation.
1: Enable analog input operation.
Related bitfields: AI_External_Gate_Select, AI_Software_Gate.
National Instruments Corporation2-55DAQ-STC Technical Reference Manual
Page 85
Chapter 2Analog Input Timing/Control
AI_External_MUX_Present
bit: 12type: Writein: AI_Mode_2_Registeraddress: 13
This bit determines when the LOCALMUX_CLK output signal pulses:
0: Pulse on every CONVERT.
1: Pulse only on CONVERTs that occur during DIV_TC.
This bit allows you to use the DIV counter for LOCALMUX_CLK signal control. This is
useful if one or more external multiplexers, such as an AMUX-64T or SCXI, are connected
to the board the DAQ-STC is on. You should set this bit to 0 if no external multiplexers are
present or if each external channel corresponds to one internal channel. You should set this
bit to 1 if one or more external multiplexers are present and if you are multiplexing more than
one external channel onto each internal channel. If this bit is set to 1, the DIV counter must
be used to determine the number of EXTMUX_CLK pulses that will correspond to one
LOCALMUX_CLK pulse.
AI_EXTMUX_CLK_Output_Select
bits: <6..7>type: Writein: AI_Output_Control_Reg isteraddress: 60
This bit enables and selects polarity for the EXTMUX_CLK output signal:
0: High Z.
1: Ground.
2: Enable, active low.
3: Enable, active high.
AI_EXTMUX_CLK_Pulse
bit: 3type: Strobein: AI_Command_1_Registeraddress: 8
Setting this bit to 1 produces a pulse on the EXTMUX_CLK output signal if the output is
enabled. The pulsewidth is determined by AI_EXTMUX_CLK_Pulse_Width. This bit is
cleared automatically. Related bitfields: AI_EXTMUX_CLK_Output_Select,
AI_EXTMUX_CLK_Pulse_Width.
AI_EXTMUX_CLK_Pulse_Width
bit: 6type: Writein: AI_Personal_Registeraddress: 77
This bit selects the pulsewidth and assertion time of the EXTMUX_CLK output signal:
0: Pulsewidth is 4.5 AI_OUT_TIMEBASE periods. EXTMUX_CLK trails the
LOCALMUX_CLK pulse by 0.5–1.5 AI_OUT_TIMEBASE periods.
1: Pulsewidth is equal to the pulsewidth of the LOCALMUX_CLK read pulse selected
by AI_LOCALMUX_CLK_Pulse_Width. EXTMUX_CLK and
LOCALMUX_CLK are asserted at the same time.
National Instruments Corporation2-57DAQ-STC Technical Reference Manual
Page 87
Chapter 2Analog Input Timing/Control
AI_FIFO_Interrupt_Enable
bit: 7type: Writein: In terrupt_A_Enable_Registeraddress: 73
This bit enables the FIFO interrupt:
0: Disabled.
1: Enabled.
The FIFO interrupt is generated on the FIFO condition indicated by AI_FIFO_Mode. Related
bitfields: AI_FIFO_Mode.
AI_FIFO_Mode
bits: <6..7>type: Writein: AI_Mode_3_Registeraddress: 87
This bit selects the AI data FIFO condition on which to generate the DMA request (output
signal AIFREQ) and the FIFO interrupt (if the FIFO interrupt is enabled):
0: Generate DMA request and FIFO interrupt on FIFO not empty. Keep the request and
interrupt asserted while the FIFO is not empty.
1: Generate DMA request and FIFO interrupt on FIFO more than half-full. Keep the
request and interrupt asserted while the FIFO is half-full.
2: Generate DMA request and FIFO interrupt on FIFO full. Keep the request and
interrupt asserted while the FIFO is full.
3: Generate DMA request and FIFO interrupt on FIFO more than half-full. Keep the
request and interrupt asserted while the FIFO is not empty.
Selection 3 will cause the request and FIFO interrupt to assert at the end of the acquisition and
remain asserted until the FIFO empties, provided that SHIFTIN arrives after the trailing edge
of the last SC_TC. The SHIFTIN signal may arrive before the trailing edge of the last SC_TC
if an internal CONVERT is used and the SI2 clock is slow with respect to the ADC interval.
In this case, you should use the SC_TC interrupt to initiate the final FIFO read at the end at
the acquisition. Related bitfields: AI_FIFO_Interrupt_Enable,
AI_FIFO_Second_Irq_Enable.
AI_FIFO_Request_St
bit: 1type: Readin: AI_Status_1_Registeraddress: 2
This bit indicates the status of the DMA request (output pin AIFREQ) and the FIFO interrupt:
0: Not asserted.
1: Asserted.
AI_FIFO_Mode selects the condition on which to generate the DMA request and FIFO
interrupt. Related bitfields: AI_FIFO_Mode.
bit: 7type: Writein: Second_ Irq_A_ E nable_Registeraddress: 74
This bit enables the FIFO interrupt in the secondary interrupt bank:
0: Disabled.
1: Enabled.
The FIFO interrupt is generated on the FIFO condition indicated by AI_FIFO_Mode. Related
bitfields: AI_FIFO_Mode.
AI_Last_Shiftin_St
bit: 15type: Readin: Joint_Status_1_Registeraddress: 27
This bit indicates that the last SHIFTIN of the acquisition has occurred. The bit is set on the
SHIFTIN following the SC_TC trailing edge. It is cleared by setting
AI_SC_TC_Interrupt_Ack to 1. Related bitfields: AI_SC_TC_Interrupt_Ack.
Note
If the SC_CLK is slow with respect to the conversion period, the trailing edge of
SC_TC may miss the SHIFTIN pulse. This can happen in the internal CONVERT
mode if you select IN_TIMEBASE2 as the SI2 source. For this reason, you must
not rely on this bit as an end of acquisition indicator.
AI_LOCALMUX_CLK_Output_Select
bits: <4..5>type: Writein: AI_Output_Control_Reg isteraddress: 60
The bitfield enables and selects the polarity of the LOCALMUX_CLK output signal:
0: High Z.
1: Ground.
2: Enable, active low.
3: Enable, active high.
AI_LOCALMUX_CLK_Pulse
bit: 2type: Strobein: AI_Command_1_Registeraddress: 8
Setting this bit to 1 produces a pulse on the LOCALMUX_CLK output signal, if the output
is enabled. The pulsewidth of the output signal is determined by
AI_LOCALMUX_CLK_Pulse_Width. LOCALMUX_CLK must also be cleared by an SOC.
This bit is cleared automatically. Related bitfields: AI_LOCALMUX_CLK_Output_Select,
AI_LOCALMUX_CLK_Pulse_Width
AI_LOCALMUX_CLK_Pulse_Width
bit: 5type: Writein: AI_Personal_Registeraddress: 77
This bit selects the pulsewidth of the LOCALMUX_FFRT output signal and the minimum
pulsewidth of the LOCALMUX_CLK output signal:
0: LOCALMUX_FFRT is 0.5–1 AI_OUT_TIMEBASE periods and
National Instruments Corporation2-59DAQ-STC Technical Reference Manual
Page 89
Chapter 2Analog Input Timing/Control
LOCALMUX_CLK is 1.5–2 AI_OUT_TIMEBASE periods.
1: LOCALMUX_FFRT is 0.5 AI_OUT_TIMEBASE periods and LOCALMUX_CLK
is 0.5–1 AI_OUT_TIMEBASE periods.
LOCALMUX_CLK must also be cleared by an SOC.
AI_Output_Divide_By_2
bit: 7type: Writein: Clo ck_and_FOUT_Registeraddress: 56
This bit determines the frequency of the internal timebase AI_OUT_TIMEBASE.
0: Same as IN_TIMEBASE.
1: IN_TIMEBASE divided by two.
AI_Overflow_St
bit: 10type: Readin: AI_Status_1_Registeraddress: 2
This bit indicates the detection of an ADC overflow error:
0: No error.
1: Error.
The overflow error indicates that an attempt was made to write the ADC result to a full AI
data FIFO; that is, the reading from the FIFO is too slow to match the writing to the FIFO. If
the overflow error occurs, at least one point of data has been lost. This bit is cleared by setting
AI_Error_Interrupt_Ack to 1.
AI_Overrun_Mode
bit: 7type: Writein: AI_Personal_Registeraddress: 77
This bit selects the period during which new CONVERT pulses are not allowed:
0: From SOC to EOC.
1: From SOC to the trailing edge of SHIFTIN.
If a CONVERT pulse occurs within the selected interval, an overrun error is detected
(AI_Overrun_St bit is set to 1).
Related bitfields: AI_Overrun_St.
AI_Overrun_St
bit: 11type: Readin: AI_Status_1_Registeraddress: 2
This bit indicates the detection of an ADC overrun error:
0: No error.
1: Error.
The overrun error indicates that the ADC interval is not long enough to complete a
conversion. This bit can be cleared by setting AI_Error_Interrupt_Ack to 1. Related bitfields:
AI_Overrun_Mode, AI_Error_Interrupt_Ack.
National Instruments Corporation2-61DAQ-STC Technical Reference Manual
Page 91
Chapter 2Analog Input Timing/Control
AI_SCAN_IN_PROG_Pulse
bit: 4type: Writein: AI_Command_1_Registeraddress: 8
Set this bit to 1 to begin a pulse on the SCAN_IN_PROG output signal, if the output is
enabled. Set this bit to 0 to end the pulse. Related bitfields:
AI_SCAN_IN_PROG_Output_Select.
AI_SC_Arm
bit: 6type: Strobein: AI_Command_1_Registeraddress: 8
This bit arms the SC counter. The counter remains armed (and the bit remains set) until it is
disarmed, either by hardware or by setting AI_Disarm to 1. Related bitfields:
AI_SC_Arm_St, AI_Disarm.
AI_SC_Armed_St
bit: 0type: Readin: AI_Status_2_Registeraddress: 5
This bit indicates whether the SC counter is armed:
0: Disarmed.
1: Armed.
Related bitfields: AI_SC_Arm.
AI_SC_Gate_Enable
bit: 15type: Writein: AI_Mode_2_Registeraddress: 13
This bit enables the SC gate:
0: Disabled.
1: Enabled.
When the SC gate is enabled, external CONVERT signals pass through the DAQ-STC only
when the SC counter is counting or, if in pretriggered mode, waiting for trigger. You must
disable the SC gate when internally generated CONVERT pulses are used.
AI_SC_Gate_St
bit: 4type: Readin: Joint_Status_1_R egisteraddress: 27
This bit indicates the status of the SC gate if the SC gate is enabled.
bit: 2type: Writein: AI_Mod e_2_ Registeraddress: 13
If the SC counter is disarmed, this bit selects the initial SC load register:
0: Load register A.
1: Load register B.
If the SC counter is armed, this bit has no effect. Related bitfields: AI_SC_Arm.
AI_SC_Load
bit: 5type: Strobein: AI_Command_1_Registeraddress: 8
If the SC counter is disarmed, this bit loads the SC counter with the contents of the selected
SC load register (A or B). If the SC counter is armed, writing to this bit has no effect. This bit
is cleared automatically. Related bitfields: AI_SC_Initial_Load_Source.
This bitfield is load register A for the SC counter. If load register A is the selected SC load
register, the SC counter loads the value contained in this bitfield on AI_SC_Load and on
SC_TC. The eight MSBs are located at the lower address and the 16 LSBs are located at the
higher address. Related Bitfields: AI_SC_Next_Load_Source_St, AI_SC_Load.
This bitfield is load register B for the SC counter. If load register B is the selected SC load
register, the SC counter loads the value contained in this bitfield on AI_SC_Load and on
SC_TC. The eight MSBs are located at the lower address and the 16 LSBs are located at the
higher address. Related Bitfields: AI_SC_Next_Load_Source_St, AI_SC_Load.
AI_SC_Next_Load_Source_St
bit: 1type: Readin: AI_Status_2_Registeraddress: 5
This bit indicates the next load source of the SC counter:
When AI_SC_Save_Trace is 0, this bitfield reflects the contents of the SC counter. When you
set AI_SC_Save_Trace to 1, this bitfield synchronously latches the contents of the SC counter
using the SC source. The eight MSBs are located at the lower address and the 16 LSBs are
located at the higher address. Related bitfields: AI_SC_Save_Trace.
bit: 4type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 causes the SC counter to switch load registers at the next SC_TC. You can
use this bit for staged analog input. This bit is cleared automatically.
AI_SC_TC_Error_Confirm
bit: 7type: Strobein: Interrupt_A_Ack_Registeraddress: 2
Setting this bit to 1 clears AI_SC_TC_Error_St. This bit is cleared automatically. Related
bitfields: AI_SC_TC_Error_St.
AI_SC_TC_Error_St
bit: 9type: Readin: AI_Status_1_Registeraddress: 2
This bit indicates the detection of an SC_TC error:
0: No error.
1: Error.
An SC_TC error is detected if AI_SC_TC_Interrupt_Ack is not set between two SC TCs.
This allows you to detect large interrupt latencies and potential problems associated with
them. To clear this bit, set SC_TC_Error_Confirm to 1. Related bitfields:
AI_SC_TC_Interrupt_Ack, AI_SC_TC_Error_Confirm.
AI_SC_TC_Interrupt_Ack
bit: 8type: Strobein: Interrupt_A_Ack_Registeraddress: 2
Setting this bit to 1 clears AI_Last_Shiftin_St, AI_SC_TC_St, and the SC_TC interrupt
request (in either interrupt bank) if the SC_TC interrupt is enabled. This bit is cleared
automatically. Related bitfields: AI_Last_Shiftin_St, AI_SC_TC_St.
AI_SC_TC_Interrupt_Enable
bit: 0ype: Writein: Interrupt_A_Enable_Registeraddress: 73
This bit enables the SC_TC interrupt:
0: Disabled.
1: Enabled.
SC_TC interrupts are generated on every SC_TC falling edge unless the pretrigger
acquisition mode is selected. In the pretrigger acquisition mode, the first SC_TC falling edge
does not generate an interrupt, but subsequent SC_TC falling edges do.
National Instruments Corporation2-65DAQ-STC Technical Reference Manual
Page 95
Chapter 2Analog Input Timing/Control
AI_SC_TC_Output_Select
bits: <2..3>type: Writein: AI_Output_Control_Reg isteraddress: 60
This bitfield enables and selects polarity for the SC_TC output signal:
0: High Z.
1: Ground.
2: Enable, active low.
3: Enable, active high.
AI_SC_TC_Pulse
bit: 1type: Writein: AI_Command_1_Registeraddress: 8
Set this bit to 1 to begin a pulse on the SC_TC output signal if the output is enabled. Set this
bit to 0 to end the pulse. Related bitfields: AI_SC_TC_Output_Select.
AI_SC_TC_Second_Irq_Enable
bit: 0type: Writein: Second_ Irq_A_ E nable_Registeraddress: 74
This bit enables the SC_TC interrupt in the secondary interrupt bank:
0: Disabled.
1: Enabled.
SC_TC interrupts are generated on every SC_TC falling edge, unless the pretrigger
acquisition mode is selected. In the pretrigger acquisition mode, the first SC_TC falling edge
does not generate an interrupt, but subsequent SC_TC falling edges do.
AI_SC_TC_St
bit: 6type: Readin: AI_Status_1_Registeraddress: 2
This bit indicates whether the SC counter has reached TC:
0: No.
1: Yes.
You can clear this bit by setting AI_SC_TC_Interrupt_Ack to 1. Related bitfields:
AI_SC_TC_Interrupt_Ack.
Refer to Table 8-2, Interrupt Condition Summary, for more information.
AI_SC_Write_Switch
bit: 0type: Writein: AI_Mod e_2_ Registeraddress: 13
This bit enables the write switch feature of the SC load registers. Writes to SC load register
A are:
0: Unconditionally directed to SC load register A.
1: Directed to the inactive SC load register.
National Instruments Corporation2-67DAQ-STC Technical Reference Manual
Page 97
Chapter 2Analog Input Timing/Control
AI_SI_Initial_Load_Source
bit: 7type: Writein: AI_Mod e_2_ Registeraddress: 13
If the SI counter is disarmed, this bit selects the initial SI load register:
0: Load register A.
1: Load register B.
If the SI counter is armed, writing to this bit has no effect.
AI_SI_Load
bit: 9type: Strobein: AI_Command_1_Registeraddress: 8
If the SI counter is disarmed, this bit loads the SI counter with the contents of the selected SI
load register (A or B). If the SI counter is armed, writing to this bit has no effect. This bit is
cleared automatically.
This bitfield is load register A for the SI counter. If load register A is the selected SI load
register, the SI counter loads the value contained in this bitfield on AI_SI_Load and on
SI_TC. The eight MSBs are located at the lower address and the 16 LSBs are located at the
higher address. Related Bitfields: AI_SI_Next_Load_Source_St, AI_SI_Load.
This bitfield is load register B for the SI counter. If load register B is the selected SI load
register, the SI counter loads the value contained in this bitfield on AI_SI_Load and on
SI_TC. The eight MSBs are located at the lower address and the 16 LSBs are located at the
higher address. Related Bitfields: AI_SI_Next_Load_Source_St, AI_SI_Load.
AI_SI_Next_Load_Source_St
bit: 6type: Readin: AI_Status_2_Registeraddress: 5
This bit indicates the next load source of the SI counter:
This bitfield reflects the contents of the SI counter. Reading from this bitfield while the SI
counter is counting may result in an erroneous value. The eight MSBs are located at the lower
address and the 16 LSBs are located at the higher address.
AI_SI_Source_Polarity
bit: 4type: Writein: AI_Mod e_1_ Registeraddress: 12
This bit selects the active edge of the SI source (the signal that is selected by
AI_SI_Source_Select):
0: Rising edge.
1: Falling edge.
Set this bit to 0 if an internal timebase is used. Related bitfields: AI_SI_Source_Select.
National Instruments Corporation2-69DAQ-STC Technical Reference Manual
Page 99
Chapter 2Analog Input Timing/Control
AI_SI_Source_Select
bits: <6..10>type: Writein: AI_Mode_1_Registeraddress: 12
This bitfield selects the SI source:
0: AI_IN_TIMEBASE1.
1–10: PFI<0..9>.
11–17: RTSI_TRIGGER<0..6>.
19: IN_TIMEBASE2.
31: Logic low.
Related bitfields: AI_SI_Source_Polarity, AI_SI2_Source_Select.
AI_SI_Special_Trigger_Delay
bit: 12type: Writein: AI_Mode_3_Registeraddress: 87
Setting this bit to 1 in the external START mode causes the SI counter to block START pulses
for a fixed time period after the START1 trigger. This feature allows you to have an extra
timing parameter in the scan timing when you use an external START. Refer to section 2.4.2,
Scan-Level Timing and Control, for more information on the SI Special Trigger Delay. Notice
that the time period may be expressed as the number of START pulses blocked. Do not set
this bit to 1 in the internal START mode.
AI_SI_Switch_Load_On_SC_TC
bit: 9type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 causes the SI counter to switch load registers at the next SC_TC. This
action is internally synchronized to the falling edge of the internal signal SI_CLK. You can
use this bit for scan rate change during an acquisition and for staged analog input. This bit is
cleared automatically.
AI_SI_Switch_Load_On_STOP
bit: 8type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 causes the SI counter to switch load registers upon receiving a STOP
trigger. This action is internally synchronized to the falling edge of the internal signal
SI_CLK. This bit is cleared automatically.
AI_SI_Switch_Load_On_TC
bit: 7type: Strobein: AI_Command_2_Registeraddress: 4
Setting this bit to 1 causes the SI counter to switch load registers at its next TC. This action
is internally synchronized to the falling edge of the internal signal SI_CLK. You can use this
bit for scan rate change during an acquisition. This bit is cleared automatically.
bit: 3type: Writein: AI_Mod e_2_ Registeraddress: 13
This bit enables the write switch feature of the SI load registers. Writes to SI load register A
are:
0: Unconditionally directed to SI load register A.
1: Directed to the inactive SI load register.
AI_SI2_Arm
bit: 12type: Strobein: AI_Command_1_Registeraddress: 8
Setting this bit to 1 arms the SI2 counter. The counter remains armed and the bit remains set
until it is disarmed, either by hardware or by setting AI_Disarm to 1. Related bitfields:
AI_SI2_Armed_St, AI_Disarm.
AI_SI2_Armed_St
bit: 11type: Readin: AI_Status_2_Registeraddress: 5
This bit indicates whether the SI2 counter is armed:
0: Disarmed.
1: Armed.
Related bitfields: AI_SI2_Arm.
AI_SI2_Initial_Load_Source
bit: 9type: Writein: AI_Mod e_2_ Registeraddress: 13
This bit selects the initial SI2 load register:
0: Load register A.
1: Load register B.
Do not change this bit while the counter is counting.
AI_SI2_Load
bit: 11type: Strobein: AI_Command_1_Registeraddress: 8
If the SI2 counter is disarmed, this bit loads the SI2 counter with the contents of the selected
SI2 load register (A or B). If the SI2 counter is armed, writing to this bit has no effect. This
bit is cleared automatically.
AI_SI2_Load_A
bits: <0..15>type: Writein: AI_SI2_Load_A_Registeraddress: 23
This bitfield is load register A for the SI2 counter. If load register A is the selected SI2 load
register, the SI2 counter loads the value contained in this bitfield on AI_SI2_Load and on
SI2_TC. Related Bitfields: AI_SI2_Next_Load_Source_St, AI_SI2_Load.