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
* #define TWI_MODULE &TWIC
* #define EXAMPLE_TS_DEVICE_ADDR AT30TSE758_ADDR_LOCAL
* #define AT30TSE758_ADDR_LOCAL 0x48
*
The application will be somewhat similar to the below
* uint8_t ibuf[16] = {0};
* static uint8_t ret = 0;
* uint8_t i = 0;
*
* irq_initialize_vectors();
* opt.
chip = EXAMPLE_TS_DEVICE_ADDR;
*
* sensor_data.config_reg.
value = 0;
* sensor_data.config_reg.option.RES = RES12;
* test_fail_indication();
* }
* char senseData[50] = {0};
* sprintf(senseData, "%d.%04d DegC",
*
*
* test_fail_indication();
* }
*
*
*
* memset(ibuf, 0, sizeof(ibuf));
*
*
* test_fail_indication();
* }
*
* if (ibuf[i] != test_pattern[i]) {
* test_fail_indication();
* }
* }
*
*
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
* opt.
chip = EXAMPLE_TS_DEVICE_ADDR;
*
*
Usage steps
Example code
Add to, e.g., main loop in application C-file:
* sprintf(senseData, "%d.%04d DegC",
*