Difference between revisions of "Component: Accelerometer (EB068, LIS3LV02DQ) (Sensors)"
(XML import) |
(XML import BR) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1. | + | | 1.5 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 21: | Line 21: | ||
==Examples== | ==Examples== | ||
− | + | Example digital spirit level using the EB068/LIS3LV02DQ sensor and the EBM001 graphical display. | |
− | + | {{Fcfile|DigSpiritLevel.fcfx|DigSpiritLevel}} | |
+ | [[File:Spirit.jpg]] | ||
==Downloadable macro reference== | ==Downloadable macro reference== | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===<span style="font-weight: normal;"><u><tt>CollectXYZData</tt></u></span>=== | ===<span style="font-weight: normal;"><u><tt>CollectXYZData</tt></u></span>=== | ||
Line 77: | Line 63: | ||
− | ===<span style="font-weight: normal;"><u><tt> | + | ===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>=== |
− | + | Sets up up the communication bus and initialises the accelerometer module. | |
+ | |||
+ | Returns 0 for success and > 0 for fail. | ||
'''Parameters''' | '''Parameters''' | ||
− | : | + | :''This macro has no parameters'' |
− | |||
− | + | '''Return value''' | |
+ | :[[Variable Types|BYTE]] | ||
− | |||
− | |||
+ | ==Simulation macro reference== | ||
− | ===<span style="font-weight: normal;"><u><tt> | + | ===<span style="font-weight: normal;"><u><tt>SimReset1G</tt></u></span>=== |
− | + | Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was | |
− | + | sitting completely horizontal. | |
'''Parameters''' | '''Parameters''' | ||
Line 106: | Line 93: | ||
'''Return value''' | '''Return value''' | ||
− | :[[Variable Types| | + | :''This call does not return a value'' |
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>SimSetXYZ</tt></u></span>=== | ||
+ | Allows the XYZ slider values to be set via the simulation | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|INT]] ''X'' | ||
+ | |||
+ | :[[Variable Types|INT]] ''Y'' | ||
+ | |||
+ | :[[Variable Types|INT]] ''Z'' | ||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
− | |||
− | |||
Line 120: | Line 120: | ||
This property is of type ''Signed integer'' and can be referenced with the variable name ''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. |
− | |||
− | |||
<span style="font-weight: normal;"><u>Bus Type</u></span> | <span style="font-weight: normal;"><u>Bus Type</u></span> | ||
Line 128: | Line 126: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''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 | ||
<span style="font-weight: normal;"><u>Channel</u></span> | <span style="font-weight: normal;"><u>Channel</u></span> | ||
Line 136: | Line 136: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''channel''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''channel''. | ||
− | + | Peripheral channel. | |
+ | Software = Create the channel using software bit banging routines - Any pin | ||
+ | Channel X = Create the channel using a hardware peripheral - Fixed pins | ||
<span style="font-weight: normal;"><u>Stop Delay</u></span> | <span style="font-weight: normal;"><u>Stop Delay</u></span> | ||
Line 158: | Line 160: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''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 | ||
<span style="font-weight: normal;"><u>Scale</u></span> | <span style="font-weight: normal;"><u>Scale</u></span> | ||
Line 166: | Line 170: | ||
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''scale''. | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''scale''. | ||
− | ''<span style=" | + | The accelerometer readings are scaled based on the maximum amount of G force the sensor can represent. |
+ | |||
+ | 6G = Bigger gravitational force | ||
+ | |||
+ | 2G = Higher resolution | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Int Option</u></span> | ||
+ | |||
+ | 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 | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Power Option</u></span> | ||
+ | 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. | ||
<span style="font-weight: normal;"><u>Interrupt Pin</u></span> | <span style="font-weight: normal;"><u>Interrupt Pin</u></span> | ||
Line 174: | Line 192: | ||
This property is of type ''Single digital pin'' and can be referenced with the variable name ''int_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. | |
− | |||
− | |||
<span style="font-weight: normal;"><u>Power Pin</u></span> | <span style="font-weight: normal;"><u>Power Pin</u></span> | ||
Line 182: | Line 198: | ||
This property is of type ''Single digital pin'' and can be referenced with the variable name ''pwr_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. | |
− | |||
− | |||
<span style="font-weight: normal;"><u>SDA Pin</u></span> | <span style="font-weight: normal;"><u>SDA Pin</u></span> | ||
Line 190: | Line 204: | ||
This property is of type ''Single digital pin'' and can be referenced with the variable name ''sda_pin''. | This property is of type ''Single digital pin'' and can be referenced with the variable name ''sda_pin''. | ||
− | + | I2C Serial Data Pin - SDA | |
− | |||
− | |||
<span style="font-weight: normal;"><u>SCL Pin</u></span> | <span style="font-weight: normal;"><u>SCL Pin</u></span> | ||
Line 198: | Line 210: | ||
This property is of type ''Single digital pin'' and can be referenced with the variable name ''scl_pin''. | This property is of type ''Single digital pin'' and can be referenced with the variable name ''scl_pin''. | ||
− | + | I2C Serial Clock Pin - SCL |
Latest revision as of 15:45, 16 February 2017
Author | Matrix Ltd. |
Version | 1.5 (Release) |
Category | Sensors |
Contents
Accelerometer (EB068, LIS3LV02DQ) 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
Example digital spirit level using the EB068/LIS3LV02DQ sensor and the EBM001 graphical display.
DigSpiritLevel
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
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
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
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
Channel
This property is of type Fixed list of ints and can be referenced with the variable name channel.
Peripheral channel.
Software = Create the channel using software bit banging routines - Any pin
Channel X = Create the channel using a hardware peripheral - Fixed pins
Stop Delay
This property is of type True or false and can be referenced with the variable name 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.
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.
SDA Pin
This property is of type Single digital pin and can be referenced with the variable name sda_pin.
I2C Serial Data Pin - SDA
SCL Pin
This property is of type Single digital pin and can be referenced with the variable name scl_pin.
I2C Serial Clock Pin - SCL