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-06-28
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Measurements
Downloaded: 3319 times
Not followed.
License: MIT license
L Meter Click is a compact and accurate Click board, capable of measuring and monitoring the inductance of the external component.
Do you want to subscribe in order to receive notifications regarding "L meter click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "L meter click" changes.
Do you want to report abuse regarding "L meter click".
Library Description
Library contains all the necessary functions for successfully reading Frequency and Inductance on the indicator.
Key functions:
uint32_t lmeter_getFrequency()
- Frequency reading function.float lmeter_getCoilInductance()
- Inductances reading function.void lmeter_tick()
- Timer Tick functions.Examples description
The application is composed of the three sections :
void applicationTask()
{
uint8_t dataReady_;
char receivedData_;
dataReady_ = UART_Rdy_Ptr( );
if (dataReady_ != 0)
{
receivedData_ = UART_Rd_Ptr( );
switch (receivedData_)
{
case 'F' :
{
mikrobus_logWrite(" --- PLEASE WAIT FOR THE CALCULATION PROCESS TO COMPLETE ---", _LOG_LINE);
lmeter_setTimer();
_Frequency = lmeter_getFrequency();
if (_Frequency < _LMETER_MIN_INDUCTANCE_RANGE)
{
mikrobus_logWrite(" Frequency is out of range !!! ", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
}
else
{
FloatToStr(_Frequency, demoText);
mikrobus_logWrite(" Frequency = ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" kHz ", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
}
break;
}
case 'L' :
{
mikrobus_logWrite(" --- PLEASE WAIT FOR THE CALCULATION PROCESS TO COMPLETE ---", _LOG_LINE);
lmeter_setTimer();
_Frequency = lmeter_getFrequency();
if (_Frequency < _LMETER_MIN_INDUCTANCE_RANGE)
{
mikrobus_logWrite(" Frequency is out of range !!! ", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
}
else
{
_Inductance = lmeter_getCoilInductance(_Frequency);
FloatToStr(_Inductance, demoText);
mikrobus_logWrite(" Inductance = ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" uH ", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
}
break;
}
case 'T' :
{
if (T_SW == _LMETER_T_SW_ENABLE)
{
T_SW = _LMETER_T_SW_DISABLE;
lmeter_setTSpin( _LMETER_T_SW_DISABLE );
mikrobus_logWrite(" --- NEW SETTINGS - DISABLE [C2] CAPACITOR --- ", _LOG_LINE);
mikrobus_logWrite("* The sum of all the capacitors is 1000pF ", _LOG_LINE);
mikrobus_logWrite("* Disabled capacitor [C2]", _LOG_LINE);
}
else
{
T_SW = _LMETER_T_SW_ENABLE;
lmeter_setTSpin( _LMETER_T_SW_ENABLE );
mikrobus_logWrite(" --- NEW SETTINGS - ENABLE [C2] CAPACITOR --- ", _LOG_LINE);
mikrobus_logWrite("* The sum of all the capacitors is 500pF ", _LOG_LINE);
mikrobus_logWrite("* Active new capacitor [C2]", _LOG_LINE);
}
break;
}
}
}
}
Other mikroE Libraries used in the example:
Conversions Library
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.