Difference between revisions of "Component: Magnetometer (SM324) (Movement Orientation)"
From Flowcode Help
Jump to navigationJump to searchLine 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/Magnetometer_SM324.fcfx FC_Comp_Source_temp/Magnetometer_SM324.fcfx] |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/ | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/Magnetometer_SM324.fcfx FC_Comp_Source_temp/Magnetometer_SM324.fcfx] |
==Detailed description== | ==Detailed description== | ||
Line 73: | Line 73: | ||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
+ | |||
+ | |||
Line 81: | Line 83: | ||
==Macro reference== | ==Macro reference== | ||
− | === | + | ===Initialise=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | 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'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===ReadMagneticFieldRaw=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadMagneticFieldRaw''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Reads the magnetic field from the last succesful data read. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG |
− | | width="90%" | | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadMagneticFieldReal=== | ||
+ | {| 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;" | '''ReadMagneticFieldReal''' | ||
|- | |- | ||
− | | | + | | colspan="2" | Reads the magnetic field from the last succesful data read as a float in Oersted Oe. |
− | |||
|- | |- | ||
− | |||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===ReadStatus=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadStatus''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation |
|- | |- | ||
|- | |- | ||
Line 147: | Line 153: | ||
− | === | + | ===ReadTemperatureReal=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadTemperatureReal''' |
|- | |- | ||
− | | colspan="2" | Reads the | + | | colspan="2" | Reads the temperature from the last succesful data read as an float in degrees C. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===RequestData=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RequestData''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Requests temperature and magnetic data from the device, returns status. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | 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'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 218: | Line 224: | ||
− | === | + | ===WriteMemory=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteMemory''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Writes a 16-bit value to the specified memory location |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | + | | width="90%" | Address |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | colspan="2" | Internal memory address |
− | |||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
+ | | width="90%" | Value | ||
|- | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
| 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 |
Revision as of 12:02, 3 February 2023
Author | Matrix TSL |
Version | 1.0 |
Category | Movement Orientation |
Contents
Magnetometer (SM324) component
SM324 ultraprecise 24-bit smart magnetometer capable of distance measurement using a magnet. Controlled via I2C bus communications.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_temp/Magnetometer_SM324.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/Magnetometer_SM324.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
Initialise
![]() |
Initialise |
Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. | |
![]() |
Return |
ReadMagneticFieldRaw
![]() |
ReadMagneticFieldRaw |
Reads the magnetic field from the last succesful data read. | |
![]() |
Return |
ReadMagneticFieldReal
![]() |
ReadMagneticFieldReal |
Reads the magnetic field from the last succesful data read as a float in Oersted Oe. | |
![]() |
Return |
ReadStatus
![]() |
ReadStatus |
Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
ReadTemperatureRaw
![]() |
ReadTemperatureRaw |
Reads the temperature from the last succesful data read. | |
![]() |
Return |
ReadTemperatureReal
![]() |
ReadTemperatureReal |
Reads the temperature from the last succesful data read as an float in degrees C. | |
![]() |
Return |
RequestData
![]() |
RequestData |
Requests temperature and magnetic data from the device, returns status. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
SetAddress
WriteCommand
![]() |
WriteCommand |
Sends a command to the sensor IC. | |
![]() |
Command |
![]() |
Return |
WriteMemory
![]() |
WriteMemory |
Writes a 16-bit value to the specified memory location | |
![]() |
Address |
Internal memory address | |
![]() |
Value |
![]() |
Return |