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-10-19
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Brushless
Downloaded: 4436 times
Not followed.
License: MIT license
Fan 4 click is a very compact, two-wire fan driver. It utilizes an integrated 5V, DC, brushless-motor driver chip. Its output voltage regulation and current limiting capabilities allow the speed control for the two-wire DC brushless motors.
Do you want to subscribe in order to receive notifications regarding "FAN 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "FAN 4 click" changes.
Do you want to report abuse regarding "FAN 4 click".
Library Description
The library performs communication with the Fan 4 Click board. The library can send command with the desired output voltage value to the DAC and can receive report from the DAC to check fault conditions. For more details check documentation.
Key functions:
T_FAN4_RETVAL fan4_setOutput( uint16_t outputVolt, uint8_t boostStartTimer )
- Function sets the output voltage on the desired value and turns on/off Boost Start Timer.T_FAN4_RETVAL fan4_checkDiagnostic( void )
- Function checks is Thermal Shutdown or Overcurrent Fault happening and returns a diagnostic state.Examples description
The application is composed of three sections :
void applicationTask()
{
if (UART_Rdy_Ptr())
{
rxDat = UART_Rd_Ptr();
switch (rxDat)
{
case '1' :
{
stepVal = _FAN4_DAC_LSB;
mikrobus_logWrite( "Voltage step is 78mV", _LOG_LINE );
break;
}
case '2' :
{
stepVal = _FAN4_DAC_LSB * 2;
mikrobus_logWrite( "Voltage step is 156mV", _LOG_LINE );
break;
}
case '3' :
{
stepVal = _FAN4_DAC_LSB * 3;
mikrobus_logWrite( "Voltage step is 234mV", _LOG_LINE );
break;
}
case '+' :
{
if (voltage <= (_FAN4_MAX_VOLT_SCALE - stepVal))
{
voltage += stepVal;
writeVoltage();
fan4_setOutput( voltage, _FAN4_BOOST_START_TIMER_DIS );
}
else
{
mikrobus_logWrite( "Voltage can't be incremented", _LOG_LINE );
}
break;
}
case '-' :
{
if (voltage >= stepVal)
{
voltage -= stepVal;
writeVoltage();
fan4_setOutput( voltage, _FAN4_BOOST_START_TIMER_DIS );
}
else
{
mikrobus_logWrite( "Voltage can't be decremented", _LOG_LINE );
}
break;
}
case '9' :
{
if (voltage != _FAN4_MAX_VOLT_SCALE)
{
voltage = _FAN4_MAX_VOLT_SCALE;
mikrobus_logWrite( "Voltage is 4922mV", _LOG_LINE );
fan4_setOutput( voltage, _FAN4_BOOST_START_TIMER_DIS );
}
else
{
mikrobus_logWrite( "Voltage is already set on maximum value", _LOG_LINE );
}
break;
}
case '0' :
{
if (voltage != _FAN4_MIN_VOLT_SCALE)
{
voltage = _FAN4_MIN_VOLT_SCALE;
mikrobus_logWrite( "Voltage is 0mV", _LOG_LINE );
fan4_setOutput( voltage, _FAN4_BOOST_START_TIMER_DIS );
}
else
{
mikrobus_logWrite( "Voltage is already set on minimum value", _LOG_LINE );
}
break;
}
case 'L' :
{
writeLegend();
break;
}
default :
{
break;
}
}
}
responseCheck = fan4_checkDiagnostic();
checkResponse();
}
Additional Functions :
Other mikroE Libraries used in the example:
Additional notes and information
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.