Component: DAC Quad (MCP4728) (MCP4728) (Analog Output)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Analog Output


Image DAC Quad (MCP4728) (MCP4728) component

Component to drive a quad digital to analogue converter (DAC) IC from Microchip via an I2C interface. Compatible with MCP4728 (12-Bit) devices.

Examples

No additional examples


Downloadable macro reference

SetOutput

Sets the output voltage of the DAC

12-Bit: Range 0-4095

Parameters

BYTE Channel
Range: 0-3 / 0=DAC Channel 0 / 1=DAC Channel 1 ...
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 Latch
0 = Data output driven from DAC register, 1 = Data output locked


Return value

This call does not return a value


SetInitialEEOutput

Stores a DAC value into EE memory to be used on power up.

Parameters

BYTE Channel
Range: 0-3 / 0=DAC Channel 0 / 1=DAC Channel 1 ...
UINT DAC_Value
The value to output to the DAC


Return value

This call does not return a value


Disable

Disables the DAC output.

Parameters

BYTE Channel
Range: 0-3 / 0=DAC Channel 0 / 1=DAC Channel 1 ...


Return value

This call does not return a value


Enable

Enables the DAC Output.

Parameters

BYTE Channel
Range: 0-3 / 0=DAC Channel 0 / 1=DAC Channel 1 ...


Return value

This call does not return a value


SetDeviceAddress

Writes a new device address into EE memory.

The use LDAC pin component property must be set to true and the LDAC pin should be unique for every MCP4728 device connected to the I2C bus.

Parameters

BYTE OldAddress
Range: 0-7
BYTE NewAddress
Range: 0-7


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

Pull Down Option

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

No additional information


VREF Option

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

No additional information


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.

Device Address

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

No additional information


Channel

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

Channel selection

SDA

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

Pin used for SDA (data signal)

SCL

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

Pin used for SCL (clock signal)

Baud Select

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

Baud rate option selector

Baud Rate

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

Baud rate to be used

Stop Delay

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

On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not

a 10ms delay between an I2C stop event and the next I2C start event.


Most modern microcontrollers will not have a problem so this property can be disabled to speed up the

I2C communications.

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 Traces

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

Scope Traces

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

Selects if the component pin connections are automatically generated on the data recorder window or not.

Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion.

No: Do not show the pin signals on the data recorder window.

Console Data

This property is of type True or false and can be referenced with the variable name cal_i2c1::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_i2c1::Injector.

Specifies the injector component on the panel to interact with to provide comms simulation.