Table of Contents
SerAccel
Reads the current acceleration of the SparkFun Electronics SerAccel triple-axis accelerometer.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library/Devices/Third-Party/SparkFun/Accelerometers')Description
The SerAccel block reads the current accelerations along the x, y and z axes of the SparkFun Electronics SerAccel v5 sensor (or later version). The SerAccel v5 device is a self-contained triple-axis accelerometer with an RS232 serial interface.
The SerAccel block spawns a separate thread to communicate with the accelerometer sensor. The priority of this thread is specified using the Thread Priority parameter of the block. Since a separate thread is generated to communicate with the accelerometer, it is not necessary to account for communication delays when setting the sample rate of the block. Note that the thread may not update the accelerometer outputs at every sampling instant.
Configuration Requirements
Display Mode
In order to use the SerAccel block, the SerAccel v5 device must be set to binary mode as its display mode. Please refer to the SerAccel v5 user manual to access the SerAccel configuration menu in order to set and/or verify the accelerometer properties such as its display mode (to be set to binary), baud rate, sensor range, and output frequency.
Calibration
Also ensure that the SerAccel v5 device has been properly calibrated. To do so, please follow the calibration procedure outlined in the SerAccel v5 user manual. For maximum measurement update rate, it is recommended that the SerAccel v5 device be configured with the highest baud rate (e.g., 57600bps) and output frequency (e.g., 595Hz) possible. Likewise for maximum acceleration measurement resolution, it is recommended to select the smallest acceleration range that fits your application needs.
Input Ports
This block has no input ports.
Output Ports
acc
A 3-vector containing the latest acceleration measurements, in
m/s2
,
along the x, y and z axes, in this order.
Parameters and Dialog Box
Serial port number
The serial port identification number used to communicate between the QUARC target and the accelerometer. Only enter
the port number. For example, enter 1
instead of COM1
,
or 2
instead of /dev/ttyS2
.
Baud rate
The selected baud rate, in bits per second, used for serial communication with the accelerometer sensor.
Sensor range
The selected sensor range, in g
, corresponding to the application's expected acceleration requirements.
Thread priority
The priority of the separate thread used to read the accelerometer measurements. In general, a value of 0 indicates the lowest priority and higher values indicate a higher priority. The number of priority levels available depends on the type of QUARC target for which code is being generated.
Sample time
The sample time, in seconds
, of the block. A sample time of 0 indicates that the block will be
treated as a continuous time block. A positive sample time indicates that the block
is a discrete time block with the given sample time.
To use the fundamental sampling time of the model, set the sample time to qc_get_step_size which is a QUARC function that returns the fundamental sampling time of the model.
The default sample time is set to qc_get_step_size.
Active during normal simulation
Indicates whether this block should access hardware during normal simulation.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
Last fully supported in QUARC 2018. |
|
Rapid Simulation (RSIM) Target |
Yes |
Yes |
|
S-Function Target |
No |
N/A |
Old technology. Use model referencing instead. |
Normal simulation |
Yes |
Yes |
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.