Component: Accelerometer 3-Axis (MMA8452Q) (Movement Orientation): Difference between revisions
Appearance
No edit summary |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 85: | Line 85: | ||
==Macro reference== | |||
===CollectXYZData=== | ===CollectXYZData=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 163: | Line 112: | ||
=== | ===Initialise=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | ||
|- | |- | ||
|- | |- | ||
| Line 178: | Line 127: | ||
===Read_N_Registers=== | ===Read_N_Registers=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Read_N_Registers''' | ||
|- | |- | ||
| colspan="2" | Reads a set of data values from sequential registers on the accelerometer | | colspan="2" | Reads a set of data values from sequential registers on the accelerometer | ||
| Line 200: | Line 149: | ||
|- | |- | ||
| colspan="2" | Data variable to populate with the register values | | colspan="2" | Data variable to populate with the register values | ||
|- | |||
| 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'' | |||
|} | |||
===Read_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" | '''Read_Register''' | |||
|- | |||
| colspan="2" | Reads a value from a register on the accelerometer. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Reg | |||
|- | |||
| colspan="2" | Register address to read from | |||
|- | |||
| 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'' | |||
|} | |||
===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. | |||
|- | |||
|- | |- | ||
| 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-void-icon.png]] - VOID | ||
| Line 207: | Line 189: | ||
===SimSetXYZ=== | ===SimSetXYZ=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 235: | Line 217: | ||
=== | ===UpdateXYZData=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''UpdateXYZData''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data | ||
|- | |- | ||
|- | |- | ||
| Line 249: | Line 231: | ||
===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 | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Reg | |||
|- | |||
| colspan="2" | Register Address to Write to | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | Value to write to the register | |||
|- | |||
| 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== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 279: | Line 283: | ||
| colspan="2" | Sets if we use the interrupt pin to check if new data is available | | colspan="2" | Sets if we use the interrupt pin to check if new data is available | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 288: | Line 292: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | I2C Connections | ||
|- | |- | ||
|- | |- | ||
| Line 332: | Line 336: | ||
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications. | | colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:36, 13 July 2026
| Author | Matrix Ltd. |
| Version | 2.0 |
| Category | Movement Orientation |
Accelerometer 3-Axis (MMA8452Q) component
MMA8452Q Accelerometer sensor with I2C. Useful for approximating Pitch and Roll or for detecting acceleration.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Accelerometer_MMA8452Q.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Accelerometer_MMA8452Q.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
CollectXYZData
Initialise
| Initialise | |
| Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | |
| Return | |
Read_N_Registers
Read_Register
| Read_Register | |
| Reads a value from a register on the accelerometer. | |
| Reg | |
| Register address to read from | |
| 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. | |
| Return | |
SimSetXYZ
| SimSetXYZ | |
| Allows the XYZ slider values to be set via the simulation | |
| X | |
| Y | |
| Z | |
| Return | |
UpdateXYZData
| UpdateXYZData | |
| Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data | |
| Return | |
Write_Register
| Write_Register | |
| Writes a data value to a specific register on the accelerometer | |
| Reg | |
| Register Address to Write to | |
| Data | |
| Value to write to the register | |
| Return | |