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.

Multiplication Problem

Other Parts Discussed in Thread: TM4C123GH6PM, ENERGIA

I'm trying to multiply an int variable and make it print the serial monitor , but it prints a char . I am using a Tiva TM4C123GH6PM , and this would be the part of the code that is giving the error: 

INT PERIOD; 

PERIOD = read () ; 
PERIOD = PERIOD * 10; 
write ( PERIOD ) ; 

read is the read function and write is the print function.

  • Hi,

    Dont' know what you type - if it is Energia or pure C. If pure C then you have three possible choises:

    A) use uartstdio.c in Tiva/utils folder

    B) look for itoa() function in internet

    C) use sprintf() function

  • Hello Bruno,

    As Petrei pointed out, you need to check that the int value stored in PERIOD is converted to an ASCII string to print to a console window using standard UART. Otherwise, the value will be sent as simple hex values and received as strange characters. If the write() function call also converts the int data to a string already, double check that you are using the correct baud rate and other serial port configuration parameters.

    Also, as noted by Petrei, if you are referencing Energia code/APIs, the Energia specific forum would be better for getting specific answers on these APIs/functions.