Ну сбосно вот :
In the Master Receiver mode, a number of data bytes are received from a Slave Transmitter .In order to enter a Master mode, a START condition must be transmitted. The format of the following address packet determines whether Master Transmitter or Master Receiver mode is to be entered. If SLA+W is transmitted, MT mode is entered, if SLA+R is transmitted, MR mode is entered. All the status codes mentioned in this section assume that the prescaler bits are zero or are masked to zero.
Потом попадаем в моду и далее по плану...
Собсно мнемоника такая -
S SLA R A DATA A DATA ~A P А если словами - то 1)посылаем старт 2)сла+р - в оригинале - In order to enter MR mode, SLA+R must be transmitted. This is done by writing SLA+R to TWDR. 3)после сидим ждём .. потом делаем действия , в зависимости от полученного кода - When SLA+R have been transmitted and an acknowledgement bit has been received, TWINT is set again and a number of status codes in TWSR are possible. Possible status codes in Master mode are 0x38, 0x40, or 0x48. The appropriate action to be taken for each of these status codes is detailed in Table .... 4) после , как написано в оригинале - получаем дату... - Received data can be read from the TWDR Register when the TWINT 5) собсно самый интересный момент - After the last byte has been received, the MR should inform the ST by sending a NACK after the last received data byte. The transfer is ended by generating a STOP condition or a repeated START condition. 6) а после передачи 0х10(репстарт) мы входим в режим слэйва опять - в оригинале - After a repeated START condition (state 0x10) the 2-wire Serial Interface can access the same Slave again, or a new Slave without transmitting a STOP condition. ну и в окончании - Repeated START enables the Master to switch between Slaves, Master Transmitter mode and Master Receiver mode without losing control over the bus.
Србсно вот и вся наука.. Flag is set high by hardware. This scheme is repeated until the last byte has been received.
Сообщение отредактировал Kuzmi4 - Mar 7 2007, 10:49
|