Analog Output
Generate voltage on the specified DAC pin
Libraries:
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, Arduino MKR ZERO, and Arduino Nano 33 IoT 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.
Variable | Arduino Board | Description | |
---|---|---|---|
Arduino Due, Arduino 33 BLE Sense | Arduino MKR1000, Arduino MKR WIFI 1010, Arduino ZERO, Arduino Nano 33 IoT | ||
Vref | 2.2 | 3.27 | Reference voltage for the DAC pin. |
input | 0 < input <
4095 | 0 < input <
1023 | 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, input provided to the block must be between 0 and 1023. Any value higher than 1023 saturates the voltage output at the DAC pin. |
N | 12 | 10 | Number of bits on DAC channel. |
Voffset | 0.56 | 0.007 | Offset voltage on Arduino board. |
Ports
Input
Parameters
Version History
Introduced in R2014a