Accel 25 click
Accel 25 Click is a compact add-on board that contains an acceleration sensor. This board features the MXC4005XC, a 12-bit three-axis thermal accelerometer from MEMSIC. It allows selectable full-scale acceleration measurements of ±2g, ±4g, or ±8g in three axes with a compatible I2C serial interface with 400KHz fast mode operation.
click Product page
Click library
- Author : Stefan Ilic
- Date : Feb 2023.
- Type : I2C type
Software Support
We provide a library for the Accel 25 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Accel 25 Click driver.
Standard key functions :
accel25_cfg_setup
Config Object Initialization function.
void accel25_cfg_setup(accel25_cfg_t *cfg)
Accel 25 configuration object setup function.
Accel 25 Click configuration object.
Definition accel25.h:301
accel25_init
Initialization function.
err_t accel25_init(accel25_t *ctx, accel25_cfg_t *cfg)
Accel 25 initialization function.
Accel 25 Click context object.
Definition accel25.h:282
accel25_default_cfg
Click Default Configuration function.
err_t accel25_default_cfg(accel25_t *ctx)
Accel 25 default configuration function.
Example key functions :
accel25_soft_reset
Accel 25 soft reset function.
err_t accel25_soft_reset(accel25_t *ctx)
Accel 25 soft reset function.
accel25_set_full_scale_range
Accel 25 set full scale range function.
err_t accel25_set_full_scale_range(accel25_t *ctx, uint8_t fsr)
Accel 25 set full scale range function.
accel25_read_data
Accel 25 read data function.
err_t accel25_read_data(accel25_t *ctx, accel25_data_t *data_out)
Accel 25 read data function.
Accel 25 Click data structure.
Definition accel25.h:317
Example Description
This example demonstrates the use of Accel 25 click board by reading and displaying accel data (X, Y, and Z axis) as well as temperature measurements on the USB UART.
The demo application is composed of two sections :
Application Init
Initializes the driver and performs the click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
accel25_init( &accel25, &accel25_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ ACCEL25_ERROR
Definition accel25.h:332
#define ACCEL25_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition accel25.h:269
void application_init(void)
Definition main.c:29
Application Task
Reads and displays the accel data (X, Y, and Z axis) as well as temperature measurements on the USB UART every 100ms approximately.
{
{
{
log_printf( &logger,
" X: %.3f g\r\n", meas_data.
x );
log_printf( &logger,
" Y: %.3f g\r\n", meas_data.
y );
log_printf( &logger,
" Z: %.3f g\r\n", meas_data.
z );
log_printf( &logger,
" Temperature: %.2f degC\r\n", meas_data.
temperature );
}
Delay_ms ( 100 );
}
}
@ ACCEL25_OK
Definition accel25.h:331
#define ACCEL25_PIN_STATE_LOW
Accel 25 pin state value.
Definition accel25.h:243
uint8_t accel25_get_int_pin(accel25_t *ctx)
Accel 25 get int pin function.
void application_task(void)
Definition main.c:65
float y
Definition accel25.h:319
float x
Definition accel25.h:318
float z
Definition accel25.h:320
float temperature
Definition accel25.h:321
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Accel25
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.