AVR i TWI (I2C)

Cześć,

Próbuję użyć TWI w AVR i mam pytanie - skąd mam wiedzieć, że STOP już został wysłany i mogę wysłać następny START?

Reply to
Adam Wysocki
Loading thread data ...

Adam Wysocki pisze:

void i2c_stop(void) { /* send stop condition */ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); // wait until stop condition is executed and bus released while(TWCR & (1<<TWSTO));

}/* i2c_stop */

Czyli dopóki TWSTO jest wysokie, to nic nie powinieneś robić. Ale.. osobiście miałem problemy z slave'ami które miały z jakiegoś powodu wolną obsługę I2C. Za stopem a przed kolejnym startem, wstawiałem delaya - i się już dobrze bujało.

Reply to
PH

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.