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/MSP430F5529: MSP430F5529

Part Number: MSP430F5529

Tool/software: Code Composer Studio

HI,

         I am working with UART of MSP430F5529, and am able to transmit one character on terminal. Now i am reading temperature data from the sensor and the value is stored in tempCelcius as show in the code below. the value i get is 31.25 and i wish to display this on terminal using UART so how should i proceed  with the code to display the temperature data. 

void ADXL362_ReadTemperature(void)
		 {


		 	   P3OUT &= ~BIT2;
		 	    SPI_RW(0x0B);
		 	    SPI_RW(0x14);
                tempdata[0]=SPI_RW(0x00);       ///temp data
		        tempdata[1] = SPI_RW(0x00);///temp data

tempdata[1]= tempdata[1]<<8;
adddata = tempdata[1]+tempdata[0];
tempCelsius = adddata * 0.065;
}

Please help me with this 

Thank You,

Pratiksha bhuta

  • Hi Pratiksha,

    First I'd like to point you to the Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430 MCUs application report. Please see the UART section that discusses using UART communication with a PC terminal. 

    The basics are, you need to decide which end will convert the temperature data to the proper ASCII characters to be displayed on the terminal. This can be done on the MSP430 using sprintf or you could use a terminal that gives you the option to interpret data as hex, binary, ascii, etc. I'll warn you though that using functions like sprintf is uncommon in an embedded application and sometimes frowned upon because they bloat the code and are typically slow to execute. 

    Best regards, 
    Caleb Overbay

  • Hi Caleb Overbay,

                                         I am not able to understand what you are trying to say , my data is stored in tempCelsius , so it acts as a pointer to the data , so how should the code be to display the data terminal ? the code that i use to display data on terminal is shown below

    void display(unsigned char a)
    { //Poll for transmit interrupt flag
    
    while (!(UCA1IFG & UCTXIFG));
    
    UCA1TXBUF = a;
    
    }

  • Hi Pratiksha,

    Without seeing the rest of your code, I cant be sure that you are properly sending data to the terminal. This would include proper USCI module setup on the MSP430. I recommend checking out our UART examples in MSP430Ware. They show how to properly setup the module for varying baudrates and clock inputs.

    Also, even though your data is stored in tempCelcius it needs to be converted to the proper ASCII format before it can be viewed on a terminal. This can either be done by the MSP430, or the terminal program. For example, let's assume tempCelcius has a value of 0x21 denoting a Celsius temperate of 33 degrees. When 0x21 is sent to the terminal it will display as "!" because that is the ASCII representation of 0x21. To properly display that information as 33 degrees you will need to convert 0x21 to the proper ASCII hex values and then send them to the terminal. The ASCII table can be found here.

    Best regards, 

    Caleb Overbay

  • Hi Pratiksha,

    Do you still need help with this issue or do you have a solution you'd like to share?

    Best regards,
    Caleb Overbay

**Attention** This is a public forum