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: 2018-09-04
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Buck
Downloaded: 4110 times
Not followed.
License: MIT license
Smart Buck click is the two-channel step-down DC/DC converter and regulator, with plenty of additional functions. It can provide voltage measurement at each of its two programmable voltage outputs, as well as the measurement of the current consumption.
Do you want to subscribe in order to receive notifications regarding "Smart Buck click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Smart Buck click" changes.
Do you want to report abuse regarding "Smart Buck click".
Library Description
Library offers a choice to communicate with all devices on Smart Buck click. The library has the ability to control both regulators, both wipers on the potentiometer, EEPROM memory and main sense chip (PAC1934). User can get from driver functions voltage(V), current(mA) and power(mW) data for each activated channel on click. The user also can perform desired configurations, that includes a number of activated channels, data format (unsigned or signed) for each channel, and data selection, which determines a configuration for conversion cycle, one sample data or more samples (averaged data) will be converted in one conversion cycle. For more details check the documentation.
Key functions:
uint8_t smartbuck_writePot( uint8_t regAddr, uint16_t dataIn )
- The function writes 16bit data to the Potentiometer register (MCP4661).void smartbuck_enRegulator1( uint8_t state )
- Function puts Regulator1 to the desired state.uint8_t smartbuck_setConfigPAC( uint8_t enChann, uint8_t dataFormat, uint8_t dataSel )
- The function sets configuration for conversion cycle for PAC1934.void smartbuck_getData( float *voltage, float *current, float *power )
- The function reads and calculates the voltage, current and power data from PAC1934 activated channels.Example description
The application is composed of three sections:
void applicationTask()
{
smartbuck_sendCmdPAC( _SMARTBUCK_REFRESH_V_CMND );
Delay_ms( 1000 );
smartbuck_getData( &voltageRes[0], ¤tRes[0], &powerRes[0] );
checkByte = 0x80;
index = 0;
for (cnt = 0; cnt < 4; cnt++)
{
if ((enabledChann & checkByte) == 0)
{
channelLog();
FloatToStr( voltageRes[ index ], text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( "V", _LOG_LINE );
FloatToStr( currentRes[ index ], text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( "mA", _LOG_LINE );
FloatToStr( powerRes[ index ], text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( "mW", _LOG_LINE );
index++;
}
checkByte >>= 1;
}
mikrobus_logWrite( "", _LOG_LINE );
}
Additional Functions :
Other MikroElektronika libraries used in the example:
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.