Registers associated with I2C

TWBR

TWBR

  • TWBR register help us to set the SCL clock frequency Untitled
  • TWPS is bit of TWSR register which full form is two wire prescale used to prescale the frequency
  • For example – calculate the SCL frequency if value of TWPS in TWSR is 1 and TWBR is 38 (00100110).assume frequency of crystal is 8 MHz. (answer is 25 KHz).

 

TWSR

 TWSR

  • TWS – TWI status, these five bits shows the status of TWI control
  • TWPS – TWI prescale bits

 

TWCR 

 TWCR

  • TWINT – TWI interrupt,  0 mean transmission continue ,1 mean transmission complete
  • TWEA – TWI enable acknowledgement,  0 mean no ack ,1 mean generate ack in slave or receiving
  • TWSTA – TWI start bit, 1 mean generate start condition If bus is free , o mean no start
  • TWSTO – TWI stop bit, 1 mean generate stop condition this bit clear by hardware set by user
  • TWWC – TWI write collision flag if 1 mean collision occur
  • TWEN – TWI enable, making this bit active TWI module is start
  • TWIE – TWI interrupt enable, 1 mean using by interrupt

 

TWDR

 TWDR

  • TWDR used to hold the data to be transmitted

 

TWAR

 TWAR

  • TWAR used to hold address to access device