IO106 - Analog input (DMA)
IO106 - Analog input (DMA) —
Reads the IO106 analog inputs (DMA)
Simulink Real-Time - Speedgoat
This driver block can be used to read frame-based data. When using this block a
setup block is not required.
Speedgoat recommends this driver block for the following case:
Acquisition rate of analog inputs required to be higher than the model
sample rate. Using DMA, the IO106 I/O module supports an acquisition
rate of up to 200 KSPS (kilo-samples per second) per channel. For
example, for a sample acquisition rate of 150 kHz, and a model
sample rate of 30 kHz, the frame-size for each active channel would
be 5. Each acquired frame is transferred by DMA to the target machine's
RAM. The IO106 I/O module driver then issues an interrupt to pace the
model execution at 30 kHz (the frame rate). In the model you could
"throw away" 4 of the 5 samples but for example use the entire frame to
store the data away.
In DMA mode, the model must contain an
Interrupt Setup block that triggers a subsystem or the model. Refer to the block
documentation for more information.
For MATLAB releases prior to R2020b, please refer to the interrupt settings
described in the MathWorks web documentation.
This driver block has n double-type output ports with the length of the frame
size, where n is the number of selected analog input channels. Each port (signal)
returns the analog value in volts.
X (X is the analog channel number)
The value from analog channel X in volts.
A unique module ID must be used for each type of I/O module Setup block in your
The module ID has two functions:
It defines the logical connection to link the I/O module driver blocks
with each other
It also has an impact on the PCI slot auto-search feature: if only one
I/O module is installed, the module ID must be set to 1. If multiple modules are installed, it must
be in the range 1:n. Not all the I/O modules installed in the target
machine need be used
PCI Slot (-1: autosearch)
There are two approaches for mapping the blocks to a specific I/O module installed
in the target machine. All modules of the same kind must be configured using the
Auto-Search: the default value -1
allows the real-time target machine to auto-search for the I/O module.
The priority is defined by the module ID (first vector element for a
multinode). The module with the lowest PCI bus/slot number is assigned
to module ID 1 (or [1 x]) and the next module found is assigned to
module ID 2 (or [2 x]), and so on
Explicit Addressing: the location of the module inside the target
machine can be explicitly defined by using the [BusNumber, SlotNumber]
format. To determine the bus number and the PCI slot number, run the
following command in the MATLAB command window:
The autocalibration is enabled by default to obtain maximum
measurement accuracy. The autocalibration function compensates for
component aging and minimizes the effects of temperature on accuracy.
The calibration normally takes approximately 2 seconds, so we recommend
increasing the host-target communication time-out in the model
configuration parameters to allow for this. The calibration is not
re-executed during normal start/stop operation once the target
application has been downloaded. All input channels are calibrated to a
single internal voltage reference. Offset and gain error corrections for
each channel are determined during the autocalibration process and are
applied to each channel in real-time during data acquisition.
Warning: Disabling the autocalibration can cause
wrong values after a change of the input range.
The input range for all A/D channels. This driver does not allow
different ranges for individual channels.
Either Single-ended, Pseudo-differential or Differential.
Single-ended: For single-ended channels, each input signal
is measured with respect to the common input return. That
is, each channel reports the difference between the input
signal voltage and the voltage present on the common input
return. This configuration provides the maximum number of
inputs channels but allows noise and other forms of
interference on the common return line to appear in the
Pseudo-differential: In this mode the first channel is
designated as the reference for all other channels, and it
is sampled value subtracted from the sampled values of all
other channels. With this arrangement, noise and
interference on the common return line is essentially
canceled, and the first input line can be used as a "remote
sense" line for channels 1 to 31.
Differential: Each input channel has a dedicated
associated reference level channel.
Number of Channels
Defines the number of channels to be acquired. The count starts with
the first channel.
Select either Initiator (default) or Target. If Initiator is selected,
A/D conversions are initiated by this module and the module outputs a
pulse train to optionally trigger other IO106 I/O modules where
"Inter-Module Synchronization" is set to Target. The pulse train is sent
on the I/O connector SYNC I/O pin. Ground is on the SYNC RTN pin (see
the I/O pin mapping section for pin numbers).
If your target machine contains a single IO106 I/O module, then
Initiator must be selected. If Target is selected, the module itself
does not start its A/D conversions, but instead triggers them using a
pulse train from another IO106 I/O module where "Inter-Module
Synchronization" is set to Initiator. The pulse train is received on the
SYNC I/O pin (ground is on the SYNC RTN pin). With this setting, there
must be at least one other IO106 I/O module present with "Inter-Module
Synchronization" set to Initiator, and the modules' SYNC I/O and SYNC
RTN pins must be physically wired together (SYNC I/O to SYNC I/O, SYNC
RTN to SYNC RTN). To use this feature with more than two IO106 I/O
modules, all SYNC I/O pins and all SYNC RTN pins must be wired together
(see the I/O pin mapping section for pin numbers). Exactly one IO106 I/O
module must be set to Initiator and all the others to Target.
Frame Size, Sample Rate and Sample Time
Parameter dependency is as follows: frame size = sample time × sample
rate. By defining two parameters, an equation will determine the third
parameter automatically, provided that parameter value for the third
parameter is set to -1.
Example: "Frame Size" of 32 and "Sample Rate" of 44100 and specifying
"Sample Time" as -1. "Sample Time" is computed automatically to be
0.0007256 seconds. In other words, this model would execute every
0.0007256 seconds, which is every 32 samples at 44 kHz.
The number of samples per frame. An interrupt occurs each time the I/O
module acquires a frame.
The frequency at which the samples are taken. This parameter is in
Hertz, and must be between 763 and 200000 Hz (763 Hz to
200 kHz). Note: The ADC clock is calculated internally by dividing
the base clock on the module by an integer value. This defines the
available frequencies. The calculation is depicted on the right hand
side of the sample clock field (base clock / clock divider = sample
The time between frame completions. Note: Sample time can only be a
multiple of ADC clocks.