2 TWI for Temperature Sensor Interfacing

The accompanying code to this application note provides a AT30TSE temperature sensor driver and the TWI master driver. The AT30TSE driver relies on the TWI master driver. Using these drivers, the configuration of the TWI and temperature sensor is very simple:
  • The pin location of the TWI module may be checked, and the alternate pin location may be selected, if necessary, in the PORTMUX peripheral.
  • Initialize the temperature sensor (requires an already defined TWI master variable)
Note: An ISR may be defined for the TWI Master interrupt vector (TWI0_TWIM_vect), which calls the TWI Master Interrupt handler function. This is required to complete a TWI transaction.
Note: If using a device with more than one TWI module, and TWI0 is not the desired module to use for the temperature sensor, certain symbols may be defined; refer to at30tse75x.c.