Component: Accelerometer (EB068) (E-blocks 1)

From Flowcode Help
Revision as of 14:50, 22 May 2018 by BenR (talk | contribs) (XML import - Pre 8.0 release)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Author Matrix TSL
Version 2.0 (Release)
Category E-blocks 1


Image Accelerometer (EB068) component

LIS3LV02DQ Accelerometer sensor with options for I2C or SPI communications. Useful for approximating Pitch and Roll or for detecting acceleration. Also available in the form of the EB068 Accelerometer E-block.

Examples

No additional examples


Downloadable macro reference

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


UpdateXYZData

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


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

SimReset1G

Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was

sitting completely horizontal.

Parameters

This macro has no parameters


Return value

This call does not return a value


SimSetXYZ

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

Bit Depth

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

The number of binary bits used to store the sensor's X,Y,Z readings.

Bus Type

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

The interface used to talk to the accelerometer.

I2C - Two Wire Interface SDA / SCL

SPI - Four Wire Interface MISO / MOSI / SCK / CS

Data Rate

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

Configures how often the sensor collects a new reading.

More often = better instant reaction to new events

Less often = more stable results

Scale

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

The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent.

6G = Bigger gravitational force

2G = Higher resolution

Int Option

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

Sets if we use the interrupt pin to check if new data is available

Power Option

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

Sets if the sensor is always powered or powered via a microcontroller output pin.

Interrupt Pin

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

Interrupt pin from the sensor, checked when performing an update to see if the sensor has new data available.

Power Pin

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

Power pin if the sensor is powered from an I/O pin.

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

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)

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.

Channel

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

SPI Channel selector

Prescale

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

Prescale option selector

MOSI

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

SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.

MISO

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

SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.

CLK

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

SPI Clock Pin CLK - The Clock signal is driven by the SPI master.

CS / SS

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

Chip Select / Slave Select Pin

Master Mode: General purpose output pin used to select the remote SPI device.

Slave Mode: Hardware chip select pin input used to select the SPI device.

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 CAL component - I2C or SPI - 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


Scope Traces

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

No additional information