4.2.1 Atmel XMEGA with TWI Interface

The following code section contains definitions related to this target.

//*********ATXMEGA TWI PARAMETERS******************************/
#if defined(ATXMEGA) && defined(TWI)    
    #include "atxmega_twi_driver.h"
    /*! \brief Largest message size that will be sent/received 
    excluding address byte and register address. When using array     
    write/read functions, the count parameter can not exceed 
    NUM_BYTES*/    
    #define NUM_BYTES 16    
    /*! TWI port used, */    
    #define TWI_PORT TWIC    
    /*! TWI master Interrupt */
    #define TWI_INT_VECTOR TWIC_TWIM_vect    
    /*BAUDRATE 100Khz*/
    #define BAUDRATE      100000
//*****************************************************************
  • NUM_BYTES defines the maximum number of data bytes that can be sent in one transfer. It is used when using the array read/write commands. The count parameter can not exceed NUM_BYTES.
  • TWI_PORT defines which TWI module is used
  • TWI_INIT_VECTOR defines the interrupt associated with that TWI module
  • BAUDRATE defines the target SCL clock frequency in hertz. For most TWI applications, it is 100kHz.