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-02-14
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Temperature & humidity
Downloaded: 5227 times
Not followed.
License: MIT license
Temp-Log click uses for temperature measurement. This click reads temperature and shows this temperature data in decimal and celsius value with determined resolution. Temp-Log click also has ALERT pin for checking high temperature limit.
Do you want to subscribe in order to receive notifications regarding "Temp-Log click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Temp-Log click" changes.
Do you want to report abuse regarding "Temp-Log click".
Library Description
Initializes and defines I2C driver, defines driver's function which writes data in registers, reads data from registers, reads and converts temperature to Celsius value with determined resolution, and checks Alert pin for temperature limit.
Key functions
Function writes 8-bit or 16-bit data in register- Function writes 8-bit or 16-bit data in register
uint16_t temp_log_readReg(uint8_t register_address);- Function reads 16-bit data from register
uint16_t temp_log_readTempDec(uint16_t resolution);- Function reads 16-bit temperature data from register with determined resolution
float temp_log_convertToCelsius(uint16_t temperature_data);- Function converts 16-bit temperature data to Celsius value
uint8_t temp_log_getAlert();- Function checks state of Alert pin (ALT)
Example description
void applicationTask() { uint16_t temperature = 0; float temp = 0; uint16_t temp_limit = 0; char txt[4] = {0}; char txt1[10] = {0}; temperature = temp_log_readTempDec(_TEMP_LOG_RESOLUTION_9_BITS); temp = temp_log_convertToCelsius(temperature); IntToStr(temperature, txt); mikrobus_logWrite("Temperature in decimal value is: ", _LOG_TEXT); mikrobus_logWrite(txt, _LOG_LINE); FloatToStr(temp, txt1); mikrobus_logWrite("Temperature in celsius value is: ", _LOG_TEXT); mikrobus_logWrite(txt1, _LOG_LINE); if(temp_log_getAlert() == 0) { mikrobus_logWrite("TEMPERATURE LIMIT ALARMING!", _LOG_LINE); } Delay_ms(1000); }
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor 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.