Difference between revisions of "Component: Magnetometer (SM324) (Movement & Orientation)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(No difference)

Latest revision as of 12:03, 25 February 2020


Author Matrix TSL
Version 1.0 (Release)
Category Movement & Orientation


Image Magnetometer (SM324) component

SM324 ultraprecise 24-bit smart magnetometer capable of distance measurement using a magnet. Controlled via I2C bus communications.

Examples

No additional examples


Downloadable 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

Parameters

This macro has no parameters


Return value

BYTE


WriteMemory

Writes a 16-bit value to the specified memory location

Parameters

BYTE Address
Internal memory address
UINT Value


Return value

This call does not return a value


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

Parameters

This macro has no parameters


Return value

BYTE


ReadTemperatureRaw

Reads the temperature from the last succesful data read.

Parameters

This macro has no parameters


Return value

LONG


ReadMagneticFieldRaw

Reads the magnetic field from the last succesful data read.

Parameters

This macro has no parameters


Return value

LONG


ReadMagneticFieldReal

Reads the magnetic field from the last succesful data read as a float in Oersted Oe.

Parameters

This macro has no parameters


Return value

LONG


SetAddress

Configures the device address used to communicate with sensor IC.

Optionally writes the new address to the sensor IC NVM.

Parameters

BYTE Address
The new address of the sensor IC, Range 8-127
BOOL WriteToIC
Writes the new address to the IC NVM 1=Write, 0=Don't Write


Return value

This call does not return a value


WriteCommand

Sends a command to the sensor IC.

Parameters

BYTE Command


Return value

This call does not return a value


ReadTemperatureReal

Reads the temperature from the last succesful data read as an float in degrees C.

Parameters

This macro has no parameters


Return value

FLOAT


Initialise

Sets up the I2C bus ready to communicate with the sensor IC.

Sets the address variable back to the Address property value.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Cyclic Mode

This property is of type Fixed list of ints and can be referenced with the variable name CyclicMode.

No additional information


Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::CHANNEL.

Channel selection

Address

This property is of type Unsigned integer and can be referenced with the variable name Address.

Address of the SM324 IC,

Default address is 16.

Valid Address range = 8 to 127

SDA

This property is of type Single digital pin and can be referenced with the variable name cal_i2c1::SDA.

Pin used for SDA (data signal)

SDA Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::SDAPins.

No additional information


SCL

This property is of type Single digital pin and can be referenced with the variable name cal_i2c1::SCL.

Pin used for SCL (clock signal)

SCL Remap Pin

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::SCLPins.

No additional information


Stop Delay

This property is of type True or false and can be referenced with the variable name cal_i2c1::StopDel.

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.

Baud Select

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::BAUD_LIST.

Baud rate option selector

Baud Rate

This property is of type Signed integer and can be referenced with the variable name cal_i2c1::BAUD.

Baud rate to be used

Threshold Pin

This property is of type Single digital pin and can be referenced with the variable name ThreshPin.

The pins used to check the DOUT pin on the SM324,

Threshold Setting

This property is of type Fixed list of ints and can be referenced with the variable name ThreshSetting.

Controls the function of the sensor IC DOUT pin.

Threshold1

This property is of type Signed integer and can be referenced with the variable name Thresh1.

Threshold 1 Value

Threshold2

This property is of type Signed integer and can be referenced with the variable name Thresh2.

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

Simulate Comms

This property is of type True or false and can be referenced with the variable name SimComms.

No additional information


Console Data

This property is of type True or false and can be referenced with the variable name cal_i2c1::ConsoleData.

Selects if the console data is automatically generated or not

Scope Traces

This property is of type True or false and can be referenced with the variable name cal_i2c1::ScopeTraces.

Selects if the component pin connections are automatically generated on the data recorder window or not.

Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion.

No: Do not show the pin signals on the data recorder window.

Injector

This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c1::Injector.

Specifies the injector component on the panel to interact with to provide comms simulation.