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: 2019-01-10
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Measurements
Downloaded: 4560 times
Not followed.
License: MIT license
The Current 2 click is an accurate current sensing Click board suitable for a very accurate measurement of the current through the load. It utilizes the high-side current sensing approach, which has a few advantages over the low-side current sensing.
Do you want to subscribe in order to receive notifications regarding "Current 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Current 2 click" changes.
Do you want to report abuse regarding "Current 2 click".
Library Description
Library offers a choice to get 10bit result from the AD converter as one sample result or averaged result with desired number of samples. Result from the ADC can be calculated to get current in a proper value [mA], depending on the RSENSE, ROUT and VREF on the Current 2 Click board. For more details check documentation.
Key functions:
uint16_t current2_getADC( void )
- Function returns 10-bit digital value from the AD converter.uint16_t current2_getAverageADC( uint8_t nSamp )
- Function returns averaged result from the AD converter.uint16_t current2_getCurrent( uint8_t nSample )
- Function reads averaged result from the ADC and performs a calculations to get current in proper value [mA].Examples description
The application is composed of the three sections :
void applicationTask()
{
current = current2_getCurrent( 20 );
WordToStr( current, text );
mikrobus_logWrite( "Current : ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " mA", _LOG_LINE );
Delay_ms( 500 );
}
Other mikroE Libraries used in the example:
Conversions
SPI
UART
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor 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.