TOP Contributors

  1. MIKROE (2664 codes)
  2. Alcides Ramos (358 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137126 times)
  2. FAT32 Library (70240 times)
  3. Network Ethernet Library (56131 times)
  4. USB Device Library (46447 times)
  5. Network WiFi Library (42100 times)
  6. FT800 Library (41410 times)
  7. GSM click (29125 times)
  8. mikroSDK (26567 times)
  9. PID Library (26510 times)
  10. microSD click (25497 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

FAN 4 click

Rating:

5

Author: MIKROE

Last Updated: 2018-10-19

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Brushless

Downloaded: 3893 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.

No Abuse Reported

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".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

FAN 4 click

FAN 4 click

Native view of the FAN 4 Click board.

View full image
FAN 4 click

FAN 4 click

Front and back view of the FAN 4 Click board.

View full image

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 :

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization - Initializes I2C interface and puts the DAC voltage value to 0V.
  • Application Task - (code snippet) - Checks the uart command (command symbol) and performs the desired command. Possible commands are incrementing and decrementing voltage by desired step, setting the step value, setting the output voltage on minimum and maximum value. To check all commands take look on legend (L).
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 :

  • checkResponse - Checks a response from driver functions and shows results on uart.
  • writeLegend - Writes all possible commands on uart.
  • writeVoltage - Writes current voltage value on uart.


Other mikroE Libraries used in the example:

  • Conversions
  • I2C
  • UART

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

IrDA 2 click

0

IrDA2 click features the TFDU4101 infrared transceiver module as well as MCP2120 infrared encoder/decoder from Microchip connected with the 7.3728 MHz external crystal. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target board via UART interface and the following mikroBUS™ pins: AN, RST, CS.

[Learn More]

Relay 2 click

5

Relay 2 click carries two LCA717 single-pole, OptoMOS® solid state relays and two screw terminals for connecting the wiring. They are controlled by the microcontroller through RL1 and RL2 pins, which are in place of default mikroBUS AN and PWM pins.

[Learn More]

Angle 4 click

5

Angle 4 click is an angular magnetic rotary sensor, which can be used as a rotary encoder. With the help of the AEAT-8800-Q24, an integrated 10 to 16-bit programmable angular magnetic encoder, the Angle 4 click can sense the magnetic field rotation aligned with the center of the sensor, over the whole range of 360°.

[Learn More]