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-05-03
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: Brushless
Downloaded: 5409 times
Not followed.
License: MIT license
Fan 2 click carries the MAX31760 precision fan-speed controller. It can also measure temperature and adjust the fan speed to keep the temperature at the same level.
The click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over I2C interface.
Do you want to subscribe in order to receive notifications regarding "Fan 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Fan 2 click" changes.
Do you want to report abuse regarding "Fan 2 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing and reading
one byte or two bytes of data in and from registers. The library includes a functions for reading temperature from internal or external sensor,reading and writing from control registers, fan fault duty cycle register, alert mask register, ideality factor Register, remote\local high set-point register,remote\local overtemperature set-point register, TACH count threshold registers, lookup table registers, direct duty-cycle control register and EEPROM LOAD/WRITE register.Current PWM duty-cycle register TACH1 count register, TACH2 Count register and status register can only be read. User can also use functions to check the state of the ALR SHD FF INT pins.
Key functions:
void fan2_writeCtrl1( uint8_t wrData )
- Function writes 8-bit data into control register 1.float fan2_readLocalTempReg()
- Function is used to read temperature from an internal measuring device.void fan2_writeLookupTable( uint8_t lutVal )
- Function is used to write into Lookup Table registers.Examples description
The application is composed of the three sections :
void applicationTask( ) { temperature = fan2_readLocalTempReg(); FloatToStr( temperature, logTxt ); mikrobus_logWrite( "Temperature : ", _LOG_TEXT ); mikrobus_logWrite( logTxt, _LOG_TEXT ); mikrobus_logWrite( degCel, _LOG_LINE ); if( temperature > 30 ) { fan2_writeDirDutCycCtrlReg( _FAN2_DUTYCYCLE_100 ); } else { fan2_writeDirDutCycCtrlReg( _FAN2_DUTYCYCLE_0 ); } Delay_ms( 1000 ); }
Other mikroE Libraries used in the example:
I2C
UART
Conversions
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.