This is the quick start guide for the AT30TS Temperature Sensor Library, with step-by-step instructions on how to configure and use the driver.
Basic use case
In the basic use case, the below setup is used:
- The type of the AT30TS component - AT30TSE758
- The development board used is Temperature Sensor Xplained
- Defined two corresponding symbols in the project properties ATAVRTEMPSENSORX, AT30TSE758
- The AT30TSE758 is connected to the TWIC of an Xmega256A3BU
- Temperature Sensor Xplained kit is plugged onto the Xmega-A3BU Xplained Development Kit
- TWI is configured as master
- 10 bytes of data is written to the device. This is read back and verified
- Temperature is read at defined intervals and displayed
Setup steps
Prerequisites
- AT30TSxx temperature sensor is interfaced via TWI
- So, we need to add TWI Master driver and define the
Example code
The device addresses given below are defined for ATAVRTEMPSENSORX development board
The application will be somewhat similar to the below
* uint8_t ibuf[16] = {0};
* static uint8_t ret = 0;
* uint8_t i = 0;
*
*
* }
* char senseData[50] = {0};
* sprintf(senseData, "%d.%04d DegC",
*
*
* }
*
*
*
* memset(ibuf, 0, sizeof(ibuf));
*
*
* }
*
* if (ibuf[i] != test_pattern[i]) {
* }
* }
*
*
Workflow
The TWI module to be used in the application can be defined in 'conf_twim.h'
- Make sure that the required preprocessor symbols for the selected sensor device and the development board (if any) are defined in the project options eg: ATAVRTEMPSENSORX , AT30TSE758
- Enable the system clock and initialize TWI as Master
Usage steps
Example code
Add to, e.g., main loop in application C-file:
* sprintf(senseData, "%d.%04d DegC",
*