This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LM3S9B92 I2C not work

The following codes doesn't work, don't know why?
please point out the faults, thanks.

***********************************************
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet();, true);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3 );
I2CMasterEnable(I2C0_MASTER_BASE);
while(1)
{ while(I2CMasterBusBusy(I2C0_MASTER_BASE)) ; I2CMasterDataPut(I2C0_MASTER_BASE, 'U');
} *************************************************

Parents
  • Start posting your code correctly formatted with the pre tags as clearly described just above the message input box.

    Then, we will be able to see on the indentation if a while loop is expected to be empty, or if it is expected to control the execution of a following statement.

    Right now, your code is unreadable. When posted, it should look like:

    #include <stdio.h>
    
    int main(void) {
        printf("Hello world!\n");
        return 0;
    }
    

Reply
  • Start posting your code correctly formatted with the pre tags as clearly described just above the message input box.

    Then, we will be able to see on the indentation if a while loop is expected to be empty, or if it is expected to control the execution of a following statement.

    Right now, your code is unreadable. When posted, it should look like:

    #include <stdio.h>
    
    int main(void) {
        printf("Hello world!\n");
        return 0;
    }
    

Children
No data