We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2020-04-15
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Battery Charger
Downloaded: 2322 times
Not followed.
License: MIT license
Balancer 2 Click is an overvoltage protection device for a 2-series cell lithium-ion battery. Click contains two separate overvoltage battery detection circuits and automatic cell imbalance correction.
Do you want to subscribe in order to receive notifications regarding "Balancer 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Balancer 2 click" changes.
Do you want to report abuse regarding "Balancer 2 click".
Library Description
Library provides control over device pins and SPI comuncation. You can read battery capacity level and it provides functions for generic spi transfer function.
Key functions:
void balancer2_generic_transfer ( uint8_t *tx_buf, uint8_t *rx_buf, uint8_t buf_len )
- Generic fucntion for SPI communicationfloat balancer2_get_batttery_lvl ( uint8_t bat_num )
- Get specific battery capcitive lvluint16_t balancer2_read_adc ( uint8_t cmd_byte )
- Read ADC value from SPIExamples description
The application is composed of three sections :
void application_task ( )
{
float battery;
char demo_str[ 30 ];
battery = balancer2_get_batttery_lvl( BALANCER2_BATT1 );
FloatToStr( battery, demo_str );
mikrobus_logWrite( "Battery 1 : ", _LOG_TEXT );
mikrobus_logWrite( demo_str, _LOG_TEXT );
mikrobus_logWrite( " mV", _LOG_LINE );
battery = balancer2_get_batttery_lvl( BALANCER2_BATT2 );
FloatToStr( battery, demo_str );
mikrobus_logWrite( "Battery 2 : ", _LOG_TEXT );
mikrobus_logWrite( demo_str, _LOG_TEXT );
mikrobus_logWrite( " mV", _LOG_LINE );
battery = balancer2_get_batttery_lvl( BALANCER2_BATT_BOTH );
FloatToStr( battery, demo_str );
mikrobus_logWrite( "Batteries : ", _LOG_TEXT );
mikrobus_logWrite( demo_str, _LOG_TEXT );
mikrobus_logWrite( " mV", _LOG_LINE );
mikrobus_logWrite( "__________________________________________", _LOG_LINE );
Delay_ms( 2000 );
}
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.