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-05-07
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Temperature & humidity
Downloaded: 4664 times
Not followed.
License: MIT license
Temp-Log click 2 is a precise ambient temperature measurement device, equipped with the additional non-volatile (EEPROM) memory, which can be used to permanently store system configuration and log application specific or user preference data.
Do you want to subscribe in order to receive notifications regarding "Temp-Log 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Temp-Log 2 click" changes.
Do you want to report abuse regarding "Temp-Log 2 click".
Library Description
Library initializes and defines I2C driver and performs communication with device registers, reading and writting. Library also performs temperature measurement and converts 16-bit temperature data to the celsius value. Library has the ability to perform EEPROM programming, and data which is written to the EEPROM will be saved after power down. After reset command data in EEPROM will be updated to the device registers. For more details check documentation.
Key functions
uint8_t templog2_writeReg( uint8_t register_address, uint16_t transfer_data )- Function writes 16-bit data to register.
uint8_t templog2_readReg( uint8_t register_address, uint16_t *dataOut )- Function reads 16-bit data from register.
uint8_t templog2_readTemp( float *tempOut, uint8_t *tempSign )- Function gets 16-bit temperature data, converts value to celsius unit and returns temperature limit status.
uint8_t templog2_setMode( uint8_t opMode, uint8_t alertMode )- Function sets device in desired operation mode and alert mode, which determines how temperature limit status be set.
Example description
The application is composed of three sections :
void applicationTask() { checkLimit = templog2_readTemp( &temperature, &temperatureSign ); FloatToStr( temperature, text ); mikrobus_logWrite( "Temperature is: ", _LOG_TEXT ); if (temperatureSign == 0) { mikrobus_logWrite( "-", _LOG_TEXT ); } mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " Celsius", _LOG_LINE ); if (checkLimit == 2) { mikrobus_logWrite( "High temperature limit detection!", _LOG_LINE ); } if (checkLimit == 1) { mikrobus_logWrite( "Low temperature limit detection!", _LOG_LINE ); } mikrobus_logWrite( "", _LOG_LINE ); }
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.