Analog In

Purpose

Asynchronous low-priority voltage measurements on an analog input channel

Library

STM32

Description

../../_images/adc.svg

The Analog In block configures channels on an ADC submodule specified by the user. The selected input channels are converted continuously without any CPU intervention. Furthermore, the channels are configured to operate in the low-priority regular conversion mode. As a result, the ADC measurement conversions are not synchronous with events created by Timer, PWM or HRTIM blocks and are interrupted by high-priority injected conversions associated with Analog In (Triggered) blocks.

The Analog In 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.

The Analog In block is well-suited to background measurements.

Note that asynchronous sampling of the Analog In block is not modeled in an offline simulation. In the offline simulation, the Analog In block samples the measured signal continuously without interruption. This approximation is acceptable only when the signal dynamics are slow compared to the sampling frequency.

Parameters

Main

ADC unit

Selects the peripheral index of the ADC submodule that is used.

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.