Component: DAC (MCP48x1) (MCP48x1) (Analog Output)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Analog Output


Image DAC (MCP48x1) (MCP48x1) component

Component to drive a digital to analogue converter (DAC) IC from Microchip via an SPI interface. Compatible with MCP4801 (8-Bit), MCP4811 (10-Bit) and MCP4821 (12-Bit) devices.

Examples

No additional examples


Downloadable macro reference

SetOutput

Sets the output voltage of the DAC

8-Bit: Range 0-255

10-Bit: Range 0-1023

12-Bit: Range 0-4095

Parameters

UINT DAC_Value
The value to output to the DAC


Return value

This call does not return a value


ControlPins

Allows Shutdown (SHDN) and Latch (LDAC) pins to be controlled directly if enabled.

Parameters

BOOL Shutdown
0 = Shutdown Device, 1 = Device Active
BOOL Latch
0 = Data output driven from DAC register, 1 = Data output locked


Return value

This call does not return a value


Disable

Disables the DAC output.

Parameters

This macro has no parameters


Return value

This call does not return a value


Enable

Enables the DAC Output.

Parameters

This macro has no parameters


Return value

This call does not return a value


Initialise

Configures the SPI peripheral ready for communications and initialises the internal variables. DAC needs to be enabled before any output voltage can be generated.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

DAC IC

This property is of type Fixed list of ints and can be referenced with the variable name DAC_IC.

Selects which DAC IC is connected and therefore the bit depth available.

Gain Option

This property is of type Fixed list of ints and can be referenced with the variable name GainOP.

Selects the maximum reference value for the DAC

Vref Voltage

This property is of type Floating point and can be referenced with the variable name VrefVol.

Reference Voltage, Used to calculate the Voltage resolution.

Steps

This property is of type Unsigned integer and can be referenced with the variable name Steps.

Number of discrete output states available from the DAC.

Control Bits

This property is of type Signed integer and can be referenced with the variable name BITS.

Number of digital control bits

Resolution

This property is of type Line of text and can be referenced with the variable name Res.

Maximum output resolution based on number of control bits.

Voltage Resolution

This property is of type Floating point and can be referenced with the variable name VoltRes.

Specifies the Resolution per digital bit in terms of Voltage.

Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::CHANNEL.

SPI Channel selector

Prescale

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::PR_SCALE.

Prescale option selector

MOSI

This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MOSI.

SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.

MISO

This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MISO.

SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.

CLK

This property is of type Single digital pin and can be referenced with the variable name cal_spi1::CLK.

SPI Clock Pin CLK - The Clock signal is driven by the SPI master.

CS / SS

This property is of type Single digital pin and can be referenced with the variable name cal_spi1::SS.

Chip Select / Slave Select Pin

Master Mode: General purpose output pin used to select the remote SPI device.

Slave Mode: Hardware chip select pin input used to select the SPI device.

Use SHDN Pin

This property is of type True or false and can be referenced with the variable name UseSHDN.

Allows the SHDN pin to be driven from an output pin on the microcontroller.

If not used then tie the SHDN pin to VCC to allow the DAC to function.

Use LDAC Pin

This property is of type True or false and can be referenced with the variable name UseLDAC.

Allows the LDAC pin to be driven from an output pin on the microcontroller.

If not used then tie the LDAC pin to GND to allow the DAC to function.

DAC Output Scope Trace

This property is of type True or false and can be referenced with the variable name ScopeTraces.

Selects if the scope traces are automatically generated or not

SPI Scope Traces

This property is of type True or false and can be referenced with the variable name cal_spi1::ScopeTraces.

Selects if the scope traces are automatically generated or not

SPI Console Data

This property is of type True or false and can be referenced with the variable name cal_spi1::ConsoleData.

Selects if the console data is automatically generated or not

Injector

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::Injector.

No additional information