Jump to content

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

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 68: Line 68:


===CollectXYZData===
===CollectXYZData===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CollectXYZData'''
| 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 
| 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 
Line 87: Line 87:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| 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. 
| colspan="2" | Sets up up the communication bus and initialises the accelerometer module.  Returns 0 for success and > 0 for fail. 
Line 101: Line 101:


===SimReset1G===
===SimReset1G===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SimReset1G'''
| 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. 
| 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. 
Line 115: Line 115:


===SimSetXYZ===
===SimSetXYZ===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SimSetXYZ'''
| width="90%" class="mtx-class-macrohead" | '''SimSetXYZ'''
|-
|-
| colspan="2" | Allows the XYZ slider values to be set via the simulation 
| colspan="2" | Allows the XYZ slider values to be set via the simulation 
Line 144: Line 144:


===UpdateXYZData===
===UpdateXYZData===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UpdateXYZData'''
| 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 
| colspan="2" | Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data 
Line 158: Line 158:


===Write_Register===
===Write_Register===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Write_Register'''
| width="90%" class="mtx-class-macrohead" | '''Write_Register'''
|-
|-
| colspan="2" | Writes a data value to a specific register on the accelerometer 
| colspan="2" | Writes a data value to a specific register on the accelerometer 
Line 183: Line 183:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 219: Line 219:
| colspan="2" | Sets if the sensor is always powered or powered via a microcontroller output pin. 
| colspan="2" | Sets if the sensor is always powered or powered via a microcontroller output pin. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 233: Line 233:
| colspan="2" | 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. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Connections
| width="90%" class="mtx-class-propfolder" | SPI Connections
|-
|-
|-
|-
Line 267: Line 267:
| 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.  
| 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.  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

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