Component: ADC (MCP356X) (Analog Input)

From Flowcode Help
Revision as of 14:33, 1 September 2021 by BenR (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Author MatrixTSL
Version 1.0 (Release)
Category Analog Input


Image ADC (MCP356X) component

An external ADC featuring 2, 4, or 8 channel 24-bit input. Capable of reading each channel independently or in differential mode. Communication using an SPI bus up to 20MHz.

Examples

No additional examples


Downloadable macro reference

SampleADC

Performs a single ADC sample and returns the result as a 24-bit value

Parameters

BYTE PositiveChannel
0=CH0 - 7=CH7, 8=GND, 9=VDD, 11=REF+, 12=REF-, 13=TP, 14=TM, 15=VCM
BYTE NegativeChannel
0=CH0 - 7=CH7, 8=GND, 9=VDD, 11=REF+, 12=REF-, 13=TP, 14=TM, 15=VCM


Return value

LONG


Initialise

Confgures the SPI bus ready for communications and initialises the MCP356X device.

Returns true if device is responding to commands.

Parameters

This macro has no parameters


Return value

BOOL : Returns true if the operation is a success, else false


Simulation macro reference

This component does not contain any simulation macros


Property reference

Device Type

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

No additional information


Device Address

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

These bits are fixed from the manufacturer and by default are 01.

Used as Bits 6 and 7 of the command byte.

Alternative bits must be requested from the manufacturer.

Clock Selection

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

No additional information


Sensor Bias Current

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

No additional information


ADC Bias Current

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

No additional information


AMCLK Prescaler

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

No additional information


Oversampling Ratio

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

No additional information


ADC Gain

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

No additional information


IRQ Mode

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

No additional information


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 IRQ

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

No: Use polling of the status register to determine when an ADC sample is complete.

Yes: Use the IRQ interrupt pin to determine when an ADC sample is complete.

IRQ Pin

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

Connected to the IRQ pin of the device, goes low on an interrupt event such as sample complete.

Simulate Comms

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

No: Simulation is done using panel sliders.

Yes: Send SPI data via API interface and show real time data using panel sliders.

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

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

API

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

Selects the API Slave to use to send and receive real world SPI data during simulation.