DAC Object

Top  Previous  Next

Provides an analog output using the integrated digital-to-analog converter (DAC).

Description

The WebCell has a dedicated pin for analog output. The analog output value can range from zero to the value of the voltage reference by setting the value property to a number in the range 0 to max. The voltage of the output pin can be computed as follows:

 

V = Vref * Cell.DAC.value / Cell.DAC.max;

 

where Vref has been assigned the actual reference voltage. Alternatively, given a desired voltage the value to set can be computed as follows:

 

Cell.DAC.value = Vtarget * Cell.DAC.max / Vref;

 

where Vtarget has been assigned the desired output voltage and Vref has been assigned the actual reference voltage.

 

To select the reference voltage, use the reference property. If an external voltage reference is used, it should be in the range 1.0V - 2.6V.

Constants

max

Gets the maximum value that can be assigned to the value property.

ref1V

Gets the constant used to select the 1.0V internal voltage reference.

refA0

Gets the constant used to select the A0 pin as the voltage reference.

refExt

Gets the constant used to select the Aref pin as the voltage reference.

refVcc

Gets the constant used to select supply voltage as the voltage reference.

Static Properties

reference

Gets or sets the source for the DAC voltage reference.

value

Gets or sets the analog value to be output.