Component: Accel Mag 6 Axis (LSM303D) (Sensors)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.6 (Release)
Category Sensors


Image Accel Mag 6_Axis (LSM303D) component

LSM303D Combined 6-Axis Accelerometer and Magnetometer sensors Useful for working out data such as Pitch and Yaw.

Examples

No additional examples


Downloadable macro reference

Read_Register

Reads a value from a register on the accelerometer.

Parameters

BYTE Reg


Return value

BYTE


SimReset1G

No additional information


Parameters

This macro has no parameters


Return value

This call does not return a value


UpdateCompassData

Reads from the compass and updates the local XYZ variables.

Returns 1 for new data and 0 for no new data

Parameters

This macro has no parameters


Return value

BYTE


Write_Register

Writes a data value to a specific register on the accelerometer

Parameters

BYTE Reg
BYTE Data


Return value

BYTE


SimSetAccelerometer

Allows the XYZ slider values to be set via the simulation

Parameters

INT X
INT Y
INT Z


Return value

This call does not return a value


CollectXYZData

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

Parameters

BYTE Axis


Return value

INT


UpdateAccelerometerData

Reads from the accelerometer and updates the local XYZ variables.

Returns 1 for new data and 0 for no new data

Parameters

This macro has no parameters


Return value

BYTE


SimSetCompass

Allows the XYZ slider values to be set via the simulation

Parameters

INT X
INT Y
INT Z


Return value

This call does not return a value


Read_Bearing

Reads the current sensor compass bearing based on degrees CW from magnetic north.

Returns 0-359 where 0 = North, 90 = East, 180 = South, 270 = West

Requires the ArcTan floating point function to be available to work correctly.

Supported on AVR, 16-bit

Parameters

BYTE NumSamples
The number of readings to base the bearing on


Return value

UINT


Initialise

Sets up up the communication bus and initialises the accelerometer module.

Returns 0 for success and > 0 for fail.

Parameters

This macro has no parameters


Return value

BYTE


Simulation macro reference

This component does not contain any simulation macros


Property reference

Bit Depth

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

No additional information


Accel Data Rate

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

No additional information


Accel Scale

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

No additional information


Compass Data Rate

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

No additional information


Compass Scale

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

No additional information


Channel

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

Channel selection

Baud Select

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

Baud rate option selector

Baud Rate

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

Baud rate to be used

Stop Delay

This property is of type True or false and can be referenced with the variable name cal_i2c::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.

SDA

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

Pin used for SDA (data signal)

SCL

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

Pin used for SCL (clock signal)

Simulation GUI

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

Yes: Accelerometer data will come from the simulation component sliders.

No: Accelerometer data will come from the I2C CAL component - Injector etc

Scope Traces

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

Selects if the scope traces are automatically generated or not

Console Data

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

Selects if the console data is automatically generated or not

Injector

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

No additional information