Jump to content

Component: ADC (AD7680) (Analog Input): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 17: Line 17:
==Component Source Code==
==Component Source Code==


Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_ExternalADC_AD7680.fcfx FC_Comp_Source_ExternalADC_AD7680.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/ExternalADC_AD7680.fcfx FC_Comp_Source_temp/ExternalADC_AD7680.fcfx]


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_ExternalADC_AD7680.fcfx FC_Comp_Source_ExternalADC_AD7680.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/ExternalADC_AD7680.fcfx FC_Comp_Source_temp/ExternalADC_AD7680.fcfx]


==Detailed description==
==Detailed description==
Line 94: Line 94:
==Circuit Diagram==
==Circuit Diagram==
[[File:AD7680 Circuit Diagram.png]]
[[File:AD7680 Circuit Diagram.png]]




Line 103: Line 105:
==Macro reference==
==Macro reference==


===SampleADC===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleADC'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
|-
| colspan="2" | Reads the ADC and returns the reading as an unsigned 16-bit value. Range: 0-65535 / 0=0V / 65535=VCC  
| colspan="2" | Initialise the SPI bus ready for communications, 
|-
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===Initialise===
===SampleADC===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleADC'''
|-
|-
| colspan="2" | Initialise the SPI bus ready for communications, 
| colspan="2" | Reads the ADC and returns the reading as an unsigned 16-bit value. Range: 0-65535 / 0=0V / 65535=VCC  
|-
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}

Revision as of 12:00, 3 February 2023

Author Matrix TSL
Version 1.0
Category Analog Input


ADC (AD7680) component

16-bit external ADC connected to the microcontroller using SPI.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/ExternalADC_AD7680.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/ExternalADC_AD7680.fcfx

Detailed description

Overview

The AD7680 is a 2.5V to 5.5V SPI compatible, successive approximation analogue to digital converter (ADC).

The reference for the AD7680 is taken internally from VDD


Pin reference from the datasheet:

Examples

This example reads the voltage on the AD7680 Vin and converts the ADC results into a voltage. For the result to be correct, you must change the Voltage variable to match the supply voltage.

AD7680 Demo

Circuit Diagram





Macro reference

Initialise

Initialise
Initialise the SPI bus ready for communications, 
- VOID Return


SampleADC

SampleADC
Reads the ADC and returns the reading as an unsigned 16-bit value. Range: 0-65535 / 0=0V / 65535=VCC  
- UINT Return



Property reference

Properties
SPI Properties
Channel
SPI Channel selector 
Prescale
Prescale option selector 
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
CS / 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.  
Simulation
Data Recorder Trace
 
Simulate Comms