Jump to content

Component: Accelerometer (EB068) (E-blocks 1): Difference between revisions

From Flowcode Help
XML import - Pre 8.0 release
 
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(16 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
| 2.0 (Release)
| 2.0
|-
|-
| width="20%" style="color: gray;" | Category
| width="20%" style="color:gray;" | Category
| E-blocks 1
| E-blocks 1
|}
|}




==Accelerometer component==
LIS3LV02DQ Accelerometer sensor with options for I2C or SPI communications. Useful for approximating Pitch and Roll or for detecting acceleration. Also available in the form of the EB068 Accelerometer E-block.


==[[File:Component Icon b81925b1_7504_4d77_ac90_3a4fa700fcc4.png|Image]] Accelerometer (EB068) component==
==Component Source Code==
LIS3LV02DQ Accelerometer sensor with options for I2C or SPI communications.
Useful for approximating Pitch and Roll or for detecting acceleration.
Also available in the form of the EB068 Accelerometer E-block.


==Examples==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Accelerometer_EB068.fcfx FC_Comp_Source_Accelerometer_EB068.fcfx]
''<span style="color:red;">No additional examples</span>''


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


==Downloadable macro reference==
==Detailed description==


===<span style="font-weight: normal;"><u><tt>CollectXYZData</tt></u></span>===
Collect the data from the local accelerometer buffers.


The Axis parameter specifies the Axis to be read.


0 / 'x' / 'X' - X axis


1 / 'y' / 'Y' - Y axis


2 / 'z' / 'Z' - Z axis


'''Parameters'''


:[[Variable Types|BYTE]] ''Axis''




'''Return value'''


:[[Variable Types|INT]]




===<span style="font-weight: normal;"><u><tt>UpdateXYZData</tt></u></span>===
Reads from the accelerometer and updates the local XYZ variables.


Returns 1 for new data and 0 for no new data
''No detailed description exists yet for this component''


'''Parameters'''
==Examples==


:''This macro has no parameters''




'''Return value'''


:[[Variable Types|BYTE]]




===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
Sets up up the communication bus and initialises the accelerometer module.


Returns 0 for success and > 0 for fail.


'''Parameters'''


:''This macro has no parameters''




'''Return value'''


:[[Variable Types|BYTE]]




''<span style="color:red;">No additional examples</span>''


==Simulation macro reference==


===<span style="font-weight: normal;"><u><tt>SimReset1G</tt></u></span>===
Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was


sitting completely horizontal.


'''Parameters'''


:''This macro has no parameters''




'''Return value'''


:''This call does not return a value''




===<span style="font-weight: normal;"><u><tt>SimSetXYZ</tt></u></span>===
Allows the XYZ slider values to be set via the simulation


'''Parameters'''


:[[Variable Types|INT]] ''X''
==Macro reference==


:[[Variable Types|INT]] ''Y''
===CollectXYZData===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''CollectXYZData'''
|-
| colspan="2" | Collect the data from the local accelerometer buffers. The Axis parameter specifies the Axis to be read. 0 / 'x' / 'X' - X axis 1 / 'y' / 'Y' - Y axis 2 / 'z' / 'Z' - Z axis&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Axis
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|INT]] ''Z''


===Initialise===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
| colspan="2" | Sets up up the communication bus and initialises the accelerometer module.  Returns 0 for success and > 0 for fail.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:''This call does not return a value''
===SimReset1G===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SimReset1G'''
|-
| colspan="2" | Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was sitting completely horizontal.&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''
|}




===SimSetXYZ===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SimSetXYZ'''
|-
| colspan="2" | Allows the XYZ slider values to be set via the simulation&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | X
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Y
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Z
|-
| colspan="2" | &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''
|}




==Property reference==
===UpdateXYZData===
<span style="font-weight: normal;"><u>Bit Depth</u></span>
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''UpdateXYZData'''
|-
| colspan="2" | Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


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


The number of binary bits used to store the sensor's X,Y,Z readings.
===Write_Register===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Write_Register'''
|-
| colspan="2" | Writes a data value to a specific register on the accelerometer&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Reg
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | &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''
|}


<span style="font-weight: normal;"><u>Bus Type</u></span>


This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''bus_type''.
==Property reference==


The interface used to talk to the accelerometer.
{| class="mtx-class-macrotable wikitable"
 
|-
I2C - Two Wire Interface SDA / SCL
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
 
| width="90%" class="mtx-class-macrohead" | '''Properties'''
SPI - Four Wire Interface MISO / MOSI / SCK / CS
|-
 
|-
<span style="font-weight: normal;"><u>Data Rate</u></span>
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Bit Depth
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''data_rate''.
|-
 
| colspan="2" | The number of binary bits used to store the sensor's X,Y,Z readings.&nbsp;
Configures how often the sensor collects a new reading.
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
More often = better instant reaction to new events
| width="90%" | Bus Type
 
|-
Less often = more stable results
| colspan="2" | The interface used to talk to the accelerometer. I2C - Two Wire Interface SDA / SCL SPI - Four Wire Interface MISO / MOSI / SCK / CS&nbsp;
 
|-
<span style="font-weight: normal;"><u>Scale</u></span>
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Data Rate
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''scale''.
|-
 
| colspan="2" | Configures how often the sensor collects a new reading. More often = better instant reaction to new events Less often = more stable results&nbsp;
The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent.
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
6G = Bigger gravitational force
| width="90%" | Scale
 
|-
2G = Higher resolution
| colspan="2" | The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent. 6G = Bigger gravitational force 2G = Higher resolution&nbsp;
 
|-
<span style="font-weight: normal;"><u>Int Option</u></span>
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Int Option
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''IntOpt''.
|-
 
| colspan="2" | Sets if we use the interrupt pin to check if new data is available&nbsp;
Sets if we use the interrupt pin to check if new data is available
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Power Option</u></span>
| width="90%" | Power Option
 
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''PowerOpt''.
| colspan="2" | Sets if the sensor is always powered or powered via a microcontroller output pin.&nbsp;
 
|-
Sets if the sensor is always powered or powered via a microcontroller output pin.
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
 
| width="90%" class="mtx-class-propfolder" | Connections
<span style="font-weight: normal;"><u>Interrupt Pin</u></span>
|-
 
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''int_pin''.
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Interrupt Pin
Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available.
|-
 
| colspan="2" | Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available. &nbsp;
<span style="font-weight: normal;"><u>Power Pin</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Single digital pin'' and can be referenced with the variable name ''pwr_pin''.
| width="90%" | Power Pin
 
|-
Power pin if the sensor is powered from an I/O pin.
| colspan="2" | Power pin if the sensor is powered from an I/O pin.&nbsp;
 
|-
<span style="font-weight: normal;"><u>Channel</u></span>
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
 
| width="90%" class="mtx-class-propfolder" | SPI Connections
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c::CHANNEL''.
|-
 
|-
Channel selection
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Channel
<span style="font-weight: normal;"><u>Baud Select</u></span>
|-
 
| colspan="2" | SPI Channel selector&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c::BAUD_LIST''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Baud rate option selector
| width="90%" | Prescale
 
|-
<span style="font-weight: normal;"><u>Baud Rate</u></span>
| colspan="2" | Prescale option selector&nbsp;
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''cal_i2c::BAUD''.
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | MOSI
Baud rate to be used
|-
 
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.&nbsp;
<span style="font-weight: normal;"><u>SDA</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_i2c::SDA''.
| width="90%" | MISO
 
|-
Pin used for SDA (data signal)
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.&nbsp;
 
|-
<span style="font-weight: normal;"><u>SCL</u></span>
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | CLK
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_i2c::SCL''.
|-
 
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.&nbsp;
Pin used for SCL (clock signal)
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
<span style="font-weight: normal;"><u>Stop Delay</u></span>
| width="90%" | CS / SS
 
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c::StopDel''.
| 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;
 
|-
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
 
| width="90%" class="mtx-class-propfolder" | Simulation
a 10ms delay between an I2C stop event and the next I2C start event.
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Simulation Coms
Most modern microcontrollers will not have a problem so this property can be disabled to speed up the
|-
 
| colspan="2" | Yes: Accelerometer data will come from the simulation component sliders. No: Accelerometer data will come from the CAL component - I2C or SPI - Injector etc&nbsp;
I2C communications.
|}
 
<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_spi::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_spi::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_spi::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 property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi::MISO''.
 
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_spi::CLK''.
 
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
 
<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_spi::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.
 
<span style="font-weight: normal;"><u>Simulation GUI</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''SimulationGUI''.
 
Yes: Accelerometer data will come from the simulation component sliders.
 
No: Accelerometer data will come from the CAL component - I2C or SPI - Injector etc
 
<span style="font-weight: normal;"><u>Scope Traces</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c::ScopeTraces''.
 
Selects if the scope traces are automatically generated or not
 
<span style="font-weight: normal;"><u>Console Data</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c::ConsoleData''.
 
Selects if the console data is automatically generated or not
 
<span style="font-weight: normal;"><u>Injector</u></span>
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c::Injector''.
 
''<span style="color:red;">No additional information</span>''
 
 
 
<span style="font-weight: normal;"><u>Scope Traces</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi::ScopeTraces''.
 
Selects if the scope traces are automatically generated or not
 
<span style="font-weight: normal;"><u>Console Data</u></span>
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi::ConsoleData''.
 
Selects if the console data is automatically generated or not
 
<span style="font-weight: normal;"><u>Injector</u></span>
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::Injector''.
 
''<span style="color:red;">No additional information</span>''

Latest revision as of 14:36, 13 July 2026

Author Matrix TSL
Version 2.0
Category E-blocks 1


Accelerometer component

LIS3LV02DQ Accelerometer sensor with options for I2C or SPI communications. Useful for approximating Pitch and Roll or for detecting acceleration. Also available in the form of the EB068 Accelerometer E-block.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Accelerometer_EB068.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Accelerometer_EB068.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

CollectXYZData

CollectXYZData
Collect the data from the local accelerometer buffers. The Axis parameter specifies the Axis to be read. 0 / 'x' / 'X' - X axis 1 / 'y' / 'Y' - Y axis 2 / 'z' / 'Z' - Z axis 
- BYTE Axis
 
- INT Return


Initialise

Initialise
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. 
- BYTE Return


SimReset1G

SimReset1G
Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was sitting completely horizontal. 
- VOID Return


SimSetXYZ

SimSetXYZ
Allows the XYZ slider values to be set via the simulation 
- INT X
 
- INT Y
 
- INT Z
 
- VOID Return


UpdateXYZData

UpdateXYZData
Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data 
- BYTE Return


Write_Register

Write_Register
Writes a data value to a specific register on the accelerometer 
- BYTE Reg
 
- BYTE Data
 
- VOID Return


Property reference

Properties
Bit Depth
The number of binary bits used to store the sensor's X,Y,Z readings. 
Bus Type
The interface used to talk to the accelerometer. I2C - Two Wire Interface SDA / SCL SPI - Four Wire Interface MISO / MOSI / SCK / CS 
Data Rate
Configures how often the sensor collects a new reading. More often = better instant reaction to new events Less often = more stable results 
Scale
The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent. 6G = Bigger gravitational force 2G = Higher resolution 
Int Option
Sets if we use the interrupt pin to check if new data is available 
Power Option
Sets if the sensor is always powered or powered via a microcontroller output pin. 
Connections
Interrupt Pin
Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available.  
Power Pin
Power pin if the sensor is powered from an I/O pin. 
SPI Connections
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
Simulation Coms
Yes: Accelerometer data will come from the simulation component sliders. No: Accelerometer data will come from the CAL component - I2C or SPI - Injector etc