Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MSP430 printing Decimal value

Status
Not open for further replies.

ajit_nayak87

Member level 5
Joined
Oct 30, 2017
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
981
Dear all

I have MSP430 Board as Development Board. I Have one variable While printing it is displayed as an ASCII value.

How can I convert 16-bit value to Decimal value while printing

The data I am passing is the Uint16_t data value from main. In debug mode, I could see properly in Hex format.

CCS support Terminal window presentation. which give in ASCII format.

i have 16bit value and Send UART in readble format i.e Decimal. How can I send using Below function.

Code:
void Serialwrite(unsigned char Byte)
{
     while(!(IFG2 & UCA0TXIFG)); // wait for TX buffer to be empty
    UCA0TXBUF = Byte;
}

/*** Function    : Serialread
**   Parameters  : None
**   Return      : unsigned char
**   Description : It will read single byte from uart
**/
unsigned char Serialread(void)
{
    while(!(IFG2 & UCA0RXIFG));
    IFG2 &= ~UCA0RXIFG;
    return UCA0RXBUF;
}
 

Hi,

a frequently asked question. Do an internet search, do a forum search.

in short: use "SPRINTF" or similar to form an ASCII sting from a 16 bit value.

BTW:
* I don´t see any 16 bit declared variable.

Klaus
 

Or if you don't want all of the overheads that the 'printf' family of functions brings (for example you don't need run-time parsing of a format string as you always use the 1 format) then look at functions such as 'itoa()'. (Ultimately that or a similar function are what the 'printf' functions call to do the work anyway.)
Susan
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top