Wayne Shumaker

IIC i2c example code question - HCS08QRUGSW

Discussion created by Wayne Shumaker on Feb 11, 2008
Latest reply on Feb 14, 2008 by MIKE YETSKO
I was looking at the example code in the HCS08QRUGSW.zip file for the GB60 IIC. I was attempting to understand the IIC behavior as slave in receive mode when it receives the stop condition on the bus. For example, I want a master GB60 i2c is sending data to a slave GB60 of an variable length of data. The sequence would be as follows:

Master sends Slave Address followed by data of variable length.
Slave receives address, set up to receive, and stores the data. How does it then detect the Stop condition from the Master?

The code in HCS08QRUGSW.zip in main.c seems to get into the condition of Slave mode, receives data and stores the data in a buffer:

         if (IIC1C_TX == 0) {                /* If data is received store it on the buffer */ 
                I2C_DATA[I2C_COUNTER]=IIC1D;
                I2C_COUNTER++;
                return;
         }

No where can I see how the variable I2C_STEP gets reset back to the ready state.

The main question is how can the IIC unit, as slave in receive mode, determine when the Stop Condition from the Master occurs, that is when the Master terminates transmission?

Outcomes