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.

CCS/TMS320F280049C: UART transmit integer

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi sir/madam

we trying to sent integer data using tms320f280049c control card, how we convert that integer to character form

ex: if we take n=234

we need to see this 234 value in my hyper terminal

thank you

  • Hello,

    Thank you for your question!

    If wanting to send characters (rather than integers), please see sci_ex2_interrupts.c in C2000Ware (in C2000Ware_version_num\driverlib\f28004x\examples\sci). This example provides use of characters rather than hex/integer transmission.

    To simplify, in C, all that is required is to enclose the character(s) being sent in quote marks e.g. n= "234\0" (NOTE: the line-ending character \0 is needed for the line to actually print on the receiving terminal), then transmit using one of the driverlib functions e.g. SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 4); (NOTE: 4 characters sent as the line-ending character is included as a character).

    Please let me know if sci_ex2_interrupts.c was useful in bringing clarity to the question!

    Regards,

    Vince

    ----------------------------------------------------------------------------------------------------------------------------

    If I was able to answer your question, please press the green "Verified" button below, thanks!

  • If you want to send an integer as string, use sprintf().

    char buf[8];

    int n = 234;

    sprintf(buf, "%d", n);

    If sprintf() is too heavyweight for you, you can use the itoa() example from K&R.