This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why have this confusing issue for data format?

Hi TI and other great guys.

I have a confusing about data format could different with define value.

Could you please help me check as below code have any mistake of define issue?

Thanks,

Eric.


#define SLAVE_DEVICE        0x48
#define I2C_DATA            0x68

int main(void) {

    WDT_A_hold(WDT_A_BASE);

    //Assign I2C pins to USCI_B0
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1);

    //Disable I2C Module to start operations
    USCI_B_I2C_disable(USCI_B0_BASE);

    //Initialize Master mode
    USCI_B_I2C_initMasterParam i2cParamSet = {USCI_B_I2C_CLOCKSOURCE_SMCLK, UCS_getSMCLK(), USCI_B_I2C_SET_DATA_RATE_400KBPS};
    USCI_B_I2C_initMaster(USCI_B0_BASE, &i2cParamSet);

    //Specify slave address
    USCI_B_I2C_setSlaveAddress(USCI_B0_BASE, SLAVE_DEVICE);  <=  Why does the define name of SLAVE_DEVICE value will become ascii code of "H"?

    //Set in transmit mode
    USCI_B_I2C_setMode(USCI_B0_BASE, USCI_B_I2C_TRANSMIT_MODE);

    //Enable I2C Module to start operations
    USCI_B_I2C_enable(USCI_B0_BASE);

    //Send single byte data.
    USCI_B_I2C_masterSendSingleByte(USCI_B0_BASE, I2C_DATA); <=  Why does the define name of SLAVE_DEVICE value will become ascii code of "h"?

    //Delay until transmission completes
    while(USCI_B_I2C_isBusBusy(USCI_B0_BASE)){;}
}

**Attention** This is a public forum