Difference between revisions of "Component: Accelerometer (EB068) (E-blocks 1)"
From Flowcode Help
Jump to navigationJump to search (XML import - Pre 8.0 release) |
|||
Line 1: | Line 1: | ||
− | + | {| style="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 | + | | 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. | ||
− | == | + | ==Component Source Code== |
− | |||
− | |||
− | |||
− | + | Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_Accelerometer_EB068.fcfx FC_Comp_Source_Accelerometer_EB068.fcfx] | |
− | |||
+ | ==Detailed description== | ||
− | + | ''No detailed description exists yet for this component'' | |
− | === | + | ==Examples== |
− | |||
− | |||
− | + | ''<span style="color:red;">No additional examples</span>'' | |
− | |||
− | + | ==Downloadable macro reference== | |
− | ''' | + | {| 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;" | '''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. | ||
+ | |- | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
− | |||
+ | {| 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;" | '''Write_Register''' | ||
+ | |- | ||
+ | | colspan="2" | Writes a data value to a specific register on the accelerometer | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Reg | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
− | |||
− | :[[ | + | {| 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;" | '''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 | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Axis | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | Reads from the accelerometer and updates the local XYZ variables. | + | |- |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UpdateXYZData''' | ||
+ | |- | ||
+ | | colspan="2" | Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data | ||
+ | |- | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
− | |||
− | ''' | + | {| 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;" | '''SimSetXYZ''' | ||
+ | |- | ||
+ | | colspan="2" | Allows the XYZ slider values to be set via the simulation | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | X | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | Y | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | Z | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
− | |||
− | + | {| 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" | Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | |
− | = | + | |- |
− | Sets up up the communication bus and initialises the accelerometer module. | + | |- |
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |
− | Returns 0 for success and > 0 for fail. | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | = | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 115: | Line 142: | ||
==Property reference== | ==Property reference== | ||
− | |||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | The number of binary bits used to store the sensor's X,Y,Z readings. | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |
− | + | | width="90%" | Bit Depth | |
− | The interface used to talk to the accelerometer. | + | |- |
− | + | | colspan="2" | The number of binary bits used to store the sensor's X,Y,Z readings. | |
− | I2C - Two Wire Interface SDA / SCL | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | SPI - Four Wire Interface MISO / MOSI / SCK / CS | + | | width="90%" | Bus Type |
− | + | |- | |
− | + | | colspan="2" | The interface used to talk to the accelerometer. I2C - Two Wire Interface SDA / SCL SPI - Four Wire Interface MISO / MOSI / SCK / CS | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Data Rate | |
− | Configures how often the sensor collects a new reading. | + | |- |
− | + | | colspan="2" | Configures how often the sensor collects a new reading. More often = better instant reaction to new events Less often = more stable results | |
− | More often = better instant reaction to new events | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | Less often = more stable results | + | | width="90%" | Scale |
− | + | |- | |
− | + | | 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 | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Int Option | |
− | The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent. | + | |- |
− | + | | colspan="2" | Sets if we use the interrupt pin to check if new data is available | |
− | 6G = Bigger gravitational force | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | 2G = Higher resolution | + | | width="90%" | Power Option |
− | + | |- | |
− | + | | 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="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | |
− | Sets if we use the interrupt pin to check if new data is available | + | |- |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | Interrupt Pin | |
− | + | |- | |
− | + | | colspan="2" | Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available. | |
− | Sets if the sensor is always powered or powered via a microcontroller output pin. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | Power Pin | |
− | + | |- | |
− | + | | colspan="2" | Power pin if the sensor is powered from an I/O pin. | |
− | + | |- | |
− | Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available. | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Connections | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Channel | |
− | Power pin if the sensor is powered from an I/O pin. | + | |- |
− | + | | colspan="2" | SPI Channel selector | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Prescale | |
− | + | |- | |
− | + | | colspan="2" | Prescale option selector | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | MOSI | |
− | + | |- | |
− | + | | colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. | |
− | + | |- | |
− | + | | 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. | |
− | + | |- | |
− | + | | 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. | |
− | + | |- | |
− | + | | 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. | |
− | + | |- | |
− | + | | 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%" | Simulation Coms | |
− | + | |- | |
− | + | | 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 | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | SPI Channel selector | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Prescale option selector | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | SPI Clock Pin CLK - The Clock signal is driven by the SPI master. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | 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. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 14:39, 16 January 2023
Author | Matrix TSL |
Version | 2.0 |
Category | E-blocks 1 |
Contents
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 for the component source code: FC_Comp_Source_Accelerometer_EB068.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Downloadable macro reference
![]() |
SimReset1G |
Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was sitting completely horizontal. | |
![]() |
Return |
![]() |
Write_Register |
Writes a data value to a specific register on the accelerometer | |
![]() |
Reg |
![]() |
Data |
![]() |
Return |
![]() |
UpdateXYZData |
Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data | |
![]() |
Return |
![]() |
SimSetXYZ |
Allows the XYZ slider values to be set via the simulation | |
![]() |
X |
![]() |
Y |
![]() |
Z |
![]() |
Return |
![]() |
Initialise |
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | |
![]() |
Return |