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.

printf unsigned long int a;

I can't seem to print out the value of a.

unsigned long int a;

//other code that assigns a value to a.

printf("%lu\n",a);

for some reason it just prints the "u" instead of a.

Is the msp430 different than regular c with this?

  • Which version of the MSP430 compiler are you using?

    Some versions had bugs in the printf / sprintf support. 

  • For size reasons, there are different levels of printf support. The smallest one AFAIK just ignores any format specifier (the '%' and the following letter). Others implement more or less of the full feature set.
    This can be configured in the project settings.

    Andrew Noble said:
    Is the msp430 different than regular c with this?

    This has nothing to do with MSP430. The printf implementation is a plain compiler-specific thing. A different compiler (and there are at tlest three I know of) may handle it differently.
    Even the support for different levels of printf support is not MSP specific. It does, however, honor the fact that on a microcontroller, code space is usually limited and unnecessary inclusion of unneeded functionality should be avoided.

**Attention** This is a public forum