void INIT_I2C(void)
{
OpenI2C(MASTER, SLEW_OFF);
SSPADD = 19;
}
unsigned int TEST = 0x0000;
unsigned char LSB = 0x00, MSB = 0x00;
while(1)
{
StartI2C(); // Start condition I2C on bus
IdleI2C();
WriteI2C(0x95); // addresses the chip + 1 LESEN
IdleI2C();
// AckI2C();
LSB = ReadI2C(); // read the value from the SLAVE and store in TEST variable.
IdleI2C();
// AckI2C();
MSB = ReadI2C();
IdleI2C();
// NotAckI2C(); // Not Acknowledge condition. This will signal the SLAVE that reading data has completed.
IdleI2C();
StopI2C(); // Stop condition I2C on bus
TEST = MSB << 8 | LSB;
MSB=0x00;
LSB=0x00;
}
Da fehlt doch was oder es ist etwas zu viel?
MfG Peter(TOO)
Manchmal frage ich mich, wieso meine Generation Geräte ohne Simulation entwickeln konnte?
Lesezeichen