Start of trail End of trail navigation bar

Table of Contents

SerAccel

Reads the current acceleration of the SparkFun Electronics SerAccel triple-axis accelerometer.

Library

QUARC Targets/Devices/Third-Party/SparkFun/Accelerometers

Description

SerAccel

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

Configure 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

Configure 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

SerAccel

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

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

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

* Compatible means that the block can be compiled for the target.

 

navigation bar