Analog In (Triggered)
Purpose
Measure the voltage on an analog input channel, synchronous to a trigger signal generated by a Timer, PWM or HRTIM
Library
STM32
Description
The Analog In (Triggered) block configures channels on an ADC submodule specified by the user. The single conversion mode is used in order to synchronize the ADC measurement conversion with counter overflow or underflow events created by Timer, PWM or HRTIM blocks. In order to give the channels priority over ADC channels configured using Analog In blocks, the Analog In (Triggered) block uses the injected conversion mode.
The Analog In (Triggered) block output signal represents the voltage measured on the input pin. The output can be scaled and an offset can be applied after scaling; it is calculated as \((input\cdot\mathbf{Scale}+\mathbf{Offset})\). If the Analog input channel(s) parameter is vectorized, each input channel is measured sequentially in the order that it appears in the input channel vector.
By setting the Trigger source parameter to Show trigger port, users can define the trigger source by connecting a Timer, PWM, or HRTIM block to the trigger inport. If Trigger source is set to Automatic, the Analog In (Triggered) block is triggere with the base task frequency. If the ADC task trigger outport is connected to the Control Task Trigger, the control task will execute once the last ADC channel is converted.
Although up to four injected measurements are supported by the STM32 ADC, only up to three channels are allowed in PLECS. This is due to an ADC silicon bug (revision Y) that can result in invalid measurements for the first channel. As a consequence, the first measurement is always discarded and the block is limited to a maximum of three conversions.
Parameters
Main
- ADC unit
Selects the peripheral index of the ADC submodule that is used.
- Trigger source
Selects an automatic or user-defined start-of-conversion trigger. If this parameter is set to automatic, the ADC will be triggered with the base task frequency.
- Analog input channel(s)
Index of the analog input channel that is used. If this parameter is vectorized, each input channel is measured sequentially in the order that it appears in the input channel vector.
- Scale(s)
A scale factor for the input signal.
- Offset(s)
An offset for the scaled input signal.
- Acquisition time
Selects between a minimal or user specified ADC acquisition time.
- Acquisition time value(s)
Sets the ADC acquisition time window in seconds \((\mathrm{s})\).
Offline only
- Resolution
The resolution of the offline ADC model in bits. The resolution is applied over the voltage reference range. If the parameter is left blank, ADC quantization is not modeled.