Analog Output

Generate voltage on the specified DAC pin

  • Library:
  • Simulink Support Package for Arduino Hardware / Common

Description

The Analog Output block generates voltage on the specified DAC pin of the board.

The block can be used only with Arduino® Due, Arduino MKR1000 boards, Arduino MKR WIFI 1010, and Arduino MKR ZERO boards:

  • The Arduino Due board has two12-bit DAC pins, DAC0 and DAC1, available for conversion. When using this board, the block accepts a uint16 value but considers only the least significant 12 bits for conversion.

  • The Arduino MKR1000, Arduino MKR WIFI 1010, and Arduino MKR ZERO boards have one 10-bit DAC pin, DAC0, available for conversion. When using these boards, the block accepts a uint16 value but considers only the least significant 10 bits for conversion.

The block outputs voltage (Vout) on the DAC pin, such that:

Vout = VrefX(input/2N-1)+ Voffset

This table explains the variables in the formula.

VariableArduino BoardDescription
Arduino DueArduino MKR1000, Arduino MKR WIFI 1010, Arduino ZERO
Vref2.23.27Reference voltage for the DAC pin.
input0 < input < 40950 < input < 1023When using Arduino Due, input provided to the block must be between 0 and 4095. Any value higher than 4095 saturates the voltage output at the DAC pin. When using Arduino MKR1000, input provided to the block must be between 0 and 1023. Any value higher than 1023 saturates the voltage output at the DAC pin.
N1210Number of bits on DAC channel.
Voffset0.560.007Offset voltage on Arduino board.

Ports

Input

expand all

When using Arduino Due, input provided to the block must be between 0 and 4095. Any value higher than 4095 saturates the voltage output at the DAC pin. When using Arduino MKR1000, Arduino MKR WIFI 1010, or Arduino MKR ZERO, input provided to the block must be between 0 and 1023. Any value higher than 1023 saturates the voltage output at the DAC pin.

Data Types: uint16

Parameters

expand all

Select a DAC pin on which to generate analog voltage. When using Arduino MKR1000, Arduino MKR WIFI 1010, or Arduino MKR ZERO board, select DAC0. The DAC pin, DAC1, is not supported on these boards.

See Also

Introduced in R2014a