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.

MSP430F1612: sscanf not working, warning #183-D: argument is incompatible with corresponding format string conversion

Part Number: MSP430F1612

Hello,

I can't get sscanf to work.

The compiler says:

warning #183-D: argument is incompatible with corresponding format string conversion

sscanf(RxBuff,"%d",PWM_gain_new);

where:

char RxBuff[20];

int PWM_gain_new = 1;

RxBuff has a zero-terminated numeric string function

sscan runs, but PWM_gain_new does not update.

Please advise.

Thanks,

Emmett

  • Like any library's implementation of any scan functions, you need to pass the address of the target variable into the function, not the value.

    The other thing to consider if you haven't already, is whether or not the data received into the RxBuff is little or big endian byte order. The MSP430 is a little-endian processor, so if the data is sent big-endian, your value will not be correctly scanned in.

    sscanf(RxBuff, "%d", &PWM_gain_new);

  • Seth,

    Thanks for the quick reply. The & was all I needed. 

    Thanks,

    Emmett

**Attention** This is a public forum