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

From Flowcode Help
Jump to navigationJump to search
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Analog Input
 
| Analog Input
 
|}
 
|}
  
  
 
+
==ADC (AD7680) component==
==[[File:Component Icon 937e425e_21c0_4b08_8d8f_0bf80a6391d2.png|Image]] ADC (AD7680) component==
 
 
16-bit external ADC connected to the microcontroller using SPI.
 
16-bit external ADC connected to the microcontroller using SPI.
  
==Detailed description==
+
==Component Pack==
  
===Overview===
+
COMMSA
The AD7680 is a 2.5V to 5.5V general purpose SPI compatible, successive
 
approximation analogue to digital converter (ADC).
 
The reference for the AD7680 is taken internally from VDD
 
Pin reference from the datasheet:
 
  
[[AD7680 Pin Reference.png]]
+
==Detailed description==
  
==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.
 
  
{{Fcfile|AD7680 Demo.fcfx|AD7680 Demo}}
 
==Circuit Diagram==
 
[[AD7680 Circuit Diagram.png]]
 
  
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SampleADC</tt></u></span>===
 
Reads the ADC and returns the reading as an unsigned 16-bit value.
 
  
Range: 0-65535 / 0=0V / 65535=VCC
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
===Overview===
Initialise the SPI bus ready for communications,
+
The AD7680 is a 2.5V to 5.5V  SPI compatible, successive
 +
approximation analogue to digital converter (ADC).
  
'''Parameters'''
+
The reference for the AD7680 is taken internally from VDD
  
:''This macro has no parameters''
 
  
 +
Pin reference from the datasheet:
  
'''Return value'''
+
[[File:AD7680 Pin Reference.png]]
  
:''This call does not return a value''
+
==Examples==
  
  
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
 
  
  
==Property reference==
 
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::CHANNEL''.
 
  
SPI Channel selector
 
  
<span style="font-weight: normal;"><u>Prescale</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::PR_SCALE''.
 
  
Prescale option selector
 
  
<span style="font-weight: normal;"><u>MOSI</u></span>
 
  
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.
 
  
<span style="font-weight: normal;"><u>MISO</u></span>
+
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.
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::MISO''.
+
{{Fcfile|AD7680 Demo.fcfx|AD7680 Demo}}
 +
==Circuit Diagram==
 +
[[File:AD7680 Circuit Diagram.png]]
  
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
 
  
<span style="font-weight: normal;"><u>CLK</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::CLK''.
+
==Downloadable macro reference==
  
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleADC'''
 +
|-
 +
| colspan="2" | Reads the ADC and returns the reading as an unsigned 16-bit value. Range: 0-65535 / 0=0V / 65535=VCC &nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
<span style="font-weight: normal;"><u>CS / SS</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::SS''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Initialise the SPI bus ready for communications,&nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
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.
 
  
<span style="font-weight: normal;"><u>Simulate Comms</u></span>
+
==Property reference==
  
This property is of type ''True or false'' and can be referenced with the variable name ''SimulateComms''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Console Data</u></span>
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Properties
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
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
<span style="font-weight: normal;"><u>Scope Traces</u></span>
+
|-
 
+
| colspan="2" | SPI Channel selector&nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi1::ScopeTraces''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Selects if the scope traces are automatically generated or not
+
| width="90%" | Prescale
 
+
|-
<span style="font-weight: normal;"><u>Injector</u></span>
+
| colspan="2" | Prescale option selector&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::Injector''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | MOSI
''<span style="color:red;">No additional information</span>''
+
|-
 +
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | MISO
 +
|-
 +
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | CLK
 +
|-
 +
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | CS / SS
 +
|-
 +
| colspan="2" | 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. &nbsp;
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Data Recorder Trace
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Simulate Comms
 +
|-
 +
| colspan="2" | &nbsp;
 +
|}

Latest revision as of 17:25, 9 November 2022

Author Matrix TSL
Version 1.0
Category Analog Input


ADC (AD7680) component

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

Component Pack

COMMSA

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:

AD7680 Pin Reference.png

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.

FC6 Icon.png AD7680 Demo

Circuit Diagram

AD7680 Circuit Diagram.png


Downloadable macro reference

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


Fc9-comp-macro.png Initialise
Initialise the SPI bus ready for communications, 
Fc9-void-icon.png - VOID Return



Property reference

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