This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Analog Input

Measure voltage of analog input pin

  • Library:
  • Simulink Coder Support Package for BBC micro:bit/Basic

    Simulink Coder Support Package for STMicroelectronics Nucleo Boards/ Common

    Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F746G-Discovery

    Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F769I-Discovery

Description

The Analog Input block measures the voltage of an analog pin relative to the analog input reference voltage on the hardware. The block outputs the measurement as a float value in the range 0–1.

  • If the measured voltage equals the ground voltage, the block emits 0.

  • If the measured voltage equals the analog reference voltage, the block emits 1.

During the external mode simulation, the block outputs the simulation results returned from the executable running on the target hardware.

During simulation in all other modes, the block outputs zeroes.

Ports

Output

expand all

If the measured voltage equals the ground voltage, the block emits 0. If the measured voltage equals the analog reference voltage, the block emits 1.

Parameters

expand all

Specify the digital pin.

To open the pin mapping table, click View pin map.

Make sure to assign different pin numbers to the different blocks of your model.

Specify how often this block measures the voltage of the analog input pin, in seconds.

When you specify this parameter as-1, Simulink® determines the best sample time for the block based on the block context within the model.