battmon
2.0.0.0
|
BATT-MON Click is a very versatile, high accuracy, multiple-chemistry battery gauge for applications single-cell batteries.
We provide a library for the BattMon 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
This library contains API for BattMon Click driver.
void battmon_cfg_setup ( battmon_cfg_t *cfg );
BATTMON_RETVAL battmon_init ( battmon_t *ctx, battmon_cfg_t *cfg );
void battmon_default_cfg ( battmon_t *ctx );
float battmon_get_data ( battmon_t *ctx, uint8_t data_addr );
uint8_t battmon_get_alm_pin ( battmon_t *ctx );
void battmon_reset_conv_cnt ( battmon_t *ctx );
This application is battery charger.
The demo application is composed of two sections :
Initializes I2C serial interface, reads the part ID and performs a device configuration and alarm setting.
Checks the conversion counter value and when conversion was done reads data calculated to the properly unit and checks the alarm status. All results will be sent to the uart terminal.
Voltage and current conversion will be done after 4 seconds. Temperature conversion will be done after 16 seconds. After temperature reading the conversion counter will be cleared. Clearing the alarm while the corresponding low-voltage or low-SOC condition is still in progress does not generate another interrupt. This condition must disappear first and must be detected again before another interrupt (ALM pin driven low or alarm interrupt bits are set high) is generated for this alarm. Another alarm condition, if not yet triggered, can still generate an interrupt. Input voltage must be in the range from 2.7V to 4.5V. Maximal battery current is 5A.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.