Component: Accel Gyro Mag 9 Axis (LSM9DS1) (Sensors)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.1 (Release)
Category Sensors


Image Accel Gyro Mag 9_Axis (LSM9DS1) component

LSM9DS1 Combined 9-Axis Accelerometer, Gyroscope and Magnetometer sensors Useful for working out orientation data such as Pitch, Yaw and Roll.

Examples

No additional examples


Downloadable macro reference

Read_Register

Reads a value from a register on the accelerometer.

Parameters

BYTE Reg


Return value

BYTE


ReadTemperature

Reads the temperature from the sensor and returns the value as an integer.

Parameters

This macro has no parameters


Return value

INT


UpdateGyroData

Reads from the gyroscope 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


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


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


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

SimSetTemperature

Allows the XYZ slider values to be set via the simulation

Parameters

INT Temp


Return value

This call does not return a value


SimReset1G

No additional information


Parameters

This macro has no parameters


Return value

This call does not return a value


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


SimSetGyro

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


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



Property reference

Accel Gryo SA0 Pin

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

Determines the LSB of the I2C device address to allow up to two sensors to work together.

Magnetometer SA0 Pin

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

Determines the LSB of the I2C device address to allow up to two sensors to work together.

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)

Accel Scale

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

Sets the output range of the accelerometer sensor

Accel Data Rate

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

Sets the accelerometer data rate and bandwidth

Gyro Scale

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

Sets the output scale of the gyro, measured in degrees per second

Gyro Data Rate

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

Sets the accelerometer data rate and bandwidth

Compass Scale

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

Sets the magnetometer full scale range - fixed at +/- 4800 uT

Compass Data Rate

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

Sets the accelerometer data rate and bandwidth

Simulation Type

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

No additional information


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