Ein DS1621.
Achso. Es müssen also nicht genau 100kHz sein, sondern nur die maximale
Frequenz darf nicht überschritten werden?
Das ist klar. Es ging mir eher um das Zurechtfinden auf der TI homepage.
Ausserdem hab ich keinen Code gefunden, der ein repeatet start aufweist.
meine I2C statemachine ist so aufgebaut, wie mans kennt:
1 | __interrupt void USI_TXRX (void)
|
2 | {
|
3 | switch(I2C_State)
|
4 | {
|
5 | case 0: // Generate Start Condition & send address to slave
|
6 | P1OUT |= 0x01; // LED on: sequence start
|
7 | USISRL = 0x00; // Generate Start Condition...
|
8 | USICTL0 |= USIGE+USIOE;
|
9 | USICTL0 &= ~USIGE;
|
10 | USISRL = SLV_Addr; // ... and transmit address, R/W = 1
|
11 | USICNT = (USICNT & 0xE0) + 0x08; // Bit counter = 8, TX Address
|
12 | I2C_State = 2; // Go to next state: receive address (N)Ack
|
13 | break;
|
14 |
|
15 | case 2: // Receive Address Ack/Nack bit
|
16 | USICTL0 &= ~USIOE; // SDA = input
|
17 | USICNT |= 0x01; // Bit counter = 1, receive (N)Ack bit
|
18 | I2C_State = 4; // Go to next state: check (N)Ack
|
19 | break;
|
20 |
|
21 | case 4: // Process Address Ack/Nack & handle data RX
|
22 | if (USISRL & 0x01) // If Nack received...
|
23 | { // Prep Stop Condition
|
24 | USICTL0 |= USIOE;
|
25 | ...
|
Aber ich brauche ein case, wo ich ein repeated start ausführe. Bekomm
ich aber irgendwie nicht auf die Reihe. Kann jemand weiterhelfen?