This shows you the differences between two versions of the page.
pm:lab:lab0xc0-7 [2020/05/04 10:39] iuliana.brinzoi [Tasks] |
pm:lab:lab0xc0-7 [2020/05/04 20:26] (current) iuliana.brinzoi [I2C (Inter-Integrated Circuit)] |
||
---|---|---|---|
Line 36: | Line 36: | ||
=== Stop Condition === | === Stop Condition === | ||
After all data frames have been exchanged, the master generates the stop condition. This is done by releasing the SDA line (switching from LOW to HIGH) after releasing the SCL line (switching from LOW to HIGH). | After all data frames have been exchanged, the master generates the stop condition. This is done by releasing the SDA line (switching from LOW to HIGH) after releasing the SCL line (switching from LOW to HIGH). | ||
+ | |||
+ | {{:pm:lab:i2c14.png?500|}} | ||
===== I2C in Atmega324 ===== | ===== I2C in Atmega324 ===== | ||
Line 45: | Line 47: | ||
=== TWSR - TWI Status Register (datasheet 21.9.3. - page 237) === | === TWSR - TWI Status Register (datasheet 21.9.3. - page 237) === | ||
=== TWDR - TWI Data Register (datasheet 21.9.4. - page 237) === | === TWDR - TWI Data Register (datasheet 21.9.4. - page 237) === | ||
+ | |||
+ | {{:pm:lab:i2c13.png?500|}} | ||
==== Library I2C Master - API ==== | ==== Library I2C Master - API ==== | ||
Line 74: | Line 78: | ||
In order to write to memory, a sequence must be sent: | In order to write to memory, a sequence must be sent: | ||
+ | |||
START | START | ||
* Send header + slave address + transmission bit | * Send header + slave address + transmission bit | ||
Line 83: | Line 88: | ||
In order to read from memory, the following sequence must be sent: | In order to read from memory, the following sequence must be sent: | ||
+ | |||
START | START | ||
* Send header + slave address + transmission bit | * Send header + slave address + transmission bit |