Hallo zusammen, ich betreibe einen PIC18f47j53 im Master I2C um den TMP112 (Temperatursensor)anzusteuern. Meine I2C Frage: Warum wird SDA nach dem ACK auf high gezogen (siehe Bild)? Ist das ein Fehler meiner Programmierung? Eigentlich bestätigt der TMP112 doch mit einem "LOW-ACK". Mein Code:
1 | SSPCON2bits.SEN = 1; //Bus übernehmen |
2 | while(SSPCON2bits.SEN); |
3 | SSP1BUF = adress; |
4 | while(SSP1STATbits.BF); |
5 | while(SSP1CON2bits.ACKSTAT); |
6 | while(SSP1STATbits.R_W); |
7 | while(!(PIR1bits.SSP1IF == 1)); //wait until bus is free |
8 | PIR1bits.SSP1IF = 0; //clear SSPF1 |
9 | |
10 | |
11 | SSP1BUF = data; |
12 | while(SSP1STATbits.BF); |
13 | while((SSP1CON2 & 0x1F)|(SSP1STATbits.R_W)); //wait until i2c is idel |
14 | while(SSP1CON2bits.ACKSTAT); // wait until ACK accure |
15 | SSPCON2bits.PEN = 1; //Bus freigeben |
16 | while(!(PIR1bits.SSP1IF == 1)); //wait until bus is free |
17 | PIR1bits.SSP1IF = 0; //clear SSPF1 |
Schon mal danke im voraus Gruß Alex


