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/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Magnetometer_SM324.fcfx FC_Comp_Source_Magnetometer_SM324.fcfx] |
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Magnetometer_SM324.fcfx FC_Comp_Source_Magnetometer_SM324.fcfx] | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Magnetometer_SM324.fcfx FC_Comp_Source_Magnetometer_SM324.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Line 44: | Line 46: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 68: | Line 72: | ||
==Macro reference== | ==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;" | '''ReadStatus''' | ||
+ | |- | ||
+ | | colspan="2" | Reads the status byte from the sensor IC. 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-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;" | '''WriteMemory''' | ||
+ | |- | ||
+ | | colspan="2" | Writes a 16-bit value to the specified memory location | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | 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="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;" | '''RequestData''' | ||
+ | |- | ||
+ | | 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-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;" | '''ReadTemperatureRaw''' | ||
+ | |- | ||
+ | | colspan="2" | Reads the temperature from the last succesful data read. | ||
+ | |- | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| 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;" | '''ReadMagneticFieldRaw''' | ||
+ | |- | ||
+ | | colspan="2" | Reads the magnetic field from the last succesful data read. | ||
+ | |- | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| 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-s32-icon.png]] - LONG | ||
+ | | 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;" | '''SetAddress''' | ||
+ | |- | ||
+ | | colspan="2" | Configures the device address used to communicate with sensor IC. Optionally writes the new address to the sensor IC NVM. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Address | ||
+ | |- | ||
+ | | colspan="2" | The new address of the sensor IC, Range 8-127 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | WriteToIC | ||
+ | |- | ||
+ | | colspan="2" | Writes the new address to the IC NVM 1=Write, 0=Don't Write | ||
+ | |- | ||
+ | | 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;" | '''WriteCommand''' | ||
+ | |- | ||
+ | | colspan="2" | Sends a command to the sensor IC. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Command | ||
+ | |- | ||
+ | | 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;" | '''ReadTemperatureReal''' | ||
+ | |- | ||
+ | | 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-f32-icon.png]] - FLOAT | ||
+ | | 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 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-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==Property reference== | ||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | 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" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Sensor Properties | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Cyclic Mode | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | I2C Properties | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Channel | ||
+ | |- | ||
+ | | colspan="2" | Channel selection | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Address | ||
+ | |- | ||
+ | | colspan="2" | Address of the SM324 IC, Default address is 16. Valid Address range = 8 to 127 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | SDA | ||
+ | |- | ||
+ | | colspan="2" | Pin used for SDA (data signal) | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | SDA Remap Pin | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | SCL | ||
+ | |- | ||
+ | | colspan="2" | Pin used for SCL (clock signal) | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | SCL Remap Pin | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Stop Delay | ||
+ | |- | ||
+ | | 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" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Baud Select | ||
+ | |- | ||
+ | | colspan="2" | Baud rate option selector | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | ||
+ | | width="90%" | Baud Rate | ||
+ | |- | ||
+ | | colspan="2" | Baud rate to be used | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Threshold Output | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | Threshold Pin | ||
+ | |- | ||
+ | | colspan="2" | The pins used to check the DOUT pin on the SM324, | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Threshold Setting | ||
+ | |- | ||
+ | | colspan="2" | Controls the function of the sensor IC DOUT pin. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | ||
+ | | width="90%" | Threshold1 | ||
+ | |- | ||
+ | | colspan="2" | Threshold 1 Value | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | ||
+ | | width="90%" | Threshold2 | ||
+ | |- | ||
+ | | colspan="2" | Threshold 2 value. If Thresh1 > Thresh2 1: Measurement > Thresh1 OR Measurement < Thresh2 0: Thresh1 > Measurement > Thresh2 If Thresh2 > Thresh1 1: Thresh1 > Measurement > Thresh2 0: Measurement > Thresh2 OR Measurement < Thresh1 | ||
+ | |- | ||
+ | | 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%" | Simulate Comms | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |}==Macro reference== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
Revision as of 09:58, 27 January 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_Magnetometer_SM324.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Magnetometer_SM324.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
![]() |
ReadStatus |
Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
![]() |
WriteMemory |
Writes a 16-bit value to the specified memory location | |
![]() |
Address |
Internal memory address | |
![]() |
Value |
![]() |
Return |
![]() |
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 |
![]() |
ReadTemperatureRaw |
Reads the temperature from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldRaw |
Reads the magnetic field from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldReal |
Reads the magnetic field from the last succesful data read as a float in Oersted Oe. | |
![]() |
Return |
![]() |
WriteCommand |
Sends a command to the sensor IC. | |
![]() |
Command |
![]() |
Return |
![]() |
ReadTemperatureReal |
Reads the temperature from the last succesful data read as an float in degrees C. | |
![]() |
Return |
![]() |
Initialise |
Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. | |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReadStatus |
Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
![]() |
WriteMemory |
Writes a 16-bit value to the specified memory location | |
![]() |
Address |
Internal memory address | |
![]() |
Value |
![]() |
Return |
![]() |
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 |
![]() |
ReadTemperatureRaw |
Reads the temperature from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldRaw |
Reads the magnetic field from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldReal |
Reads the magnetic field from the last succesful data read as a float in Oersted Oe. | |
![]() |
Return |
![]() |
WriteCommand |
Sends a command to the sensor IC. | |
![]() |
Command |
![]() |
Return |
![]() |
ReadTemperatureReal |
Reads the temperature from the last succesful data read as an float in degrees C. | |
![]() |
Return |
![]() |
Initialise |
Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. | |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReadStatus |
Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
![]() |
WriteMemory |
Writes a 16-bit value to the specified memory location | |
![]() |
Address |
Internal memory address | |
![]() |
Value |
![]() |
Return |
![]() |
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 |
![]() |
ReadTemperatureRaw |
Reads the temperature from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldRaw |
Reads the magnetic field from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldReal |
Reads the magnetic field from the last succesful data read as a float in Oersted Oe. | |
![]() |
Return |
![]() |
WriteCommand |
Sends a command to the sensor IC. | |
![]() |
Command |
![]() |
Return |
![]() |
ReadTemperatureReal |
Reads the temperature from the last succesful data read as an float in degrees C. | |
![]() |
Return |
![]() |
Initialise |
Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. | |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReadStatus |
Reads the status byte from the sensor IC. Bit 6 = Voltage OK Bit 5 = Busy Bit 2 = Memory Error Bit 0 = Saturation | |
![]() |
Return |
![]() |
WriteMemory |
Writes a 16-bit value to the specified memory location | |
![]() |
Address |
Internal memory address | |
![]() |
Value |
![]() |
Return |
![]() |
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 |
![]() |
ReadTemperatureRaw |
Reads the temperature from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldRaw |
Reads the magnetic field from the last succesful data read. | |
![]() |
Return |
![]() |
ReadMagneticFieldReal |
Reads the magnetic field from the last succesful data read as a float in Oersted Oe. | |
![]() |
Return |
![]() |
WriteCommand |
Sends a command to the sensor IC. | |
![]() |
Command |
![]() |
Return |
![]() |
ReadTemperatureReal |
Reads the temperature from the last succesful data read as an float in degrees C. | |
![]() |
Return |
![]() |
Initialise |
Sets up the I2C bus ready to communicate with the sensor IC. Sets the address variable back to the Address property value. | |
![]() |
Return |