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.

LP-MSP430FR2476: printing two digit integers in teraterm

Part Number: LP-MSP430FR2476


Hi,

I added uart print functions from 

Lesson 9: UART – Simply Embedded

uart_putchar(RXData[3]+'0');

This works to print single digit numbers as char. Two digit integers are printing blank. How to fix this?

Thanks,

Priya

  • You need to create a string using something like itoa() from K&R.

    If you *only* want two digit integers you can do something like:

    int i = 42;

    // print MSD

    char msd = (i/10) + '0';

    uart_putchar(msd);

    // print LSD

    char lsd = (i % 10) + '0';

    uart_putchar(lsd)

**Attention** This is a public forum