Jump to content
Sign in to follow this  
Seo

Tiva C Uart Changing UARTCharPutNonBlocking

Recommended Posts

Hi Everyone

Im newbie in tiva c.

I am writing code for adc. It sending with uart.

I am sending adc values.

         a[3] = ulADC0Value[0]%10 + 48;
        ulADC0Value[0] = ulADC0Value[0]/10 ;
        a[2] = ulADC0Value[0]%10 + 48;
        ulADC0Value[0] = ulADC0Value[0]/10 ;
        a[1] = ulADC0Value[0]%10 + 48;
        a[0] = ulADC0Value[0]/10 + 48;
       UARTCharPutNonBlocking(UART0_BASE, a[0]);
            UARTCharPutNonBlocking(UART0_BASE, a[1]); 
            UARTCharPutNonBlocking(UART0_BASE, a[2]);
            UARTCharPutNonBlocking(UART0_BASE, a[3]);

But this sending only one charecter. I want to send data in a line.

Example

            UARTCharPutNonBlocking(UART0_BASE,50);

but its sending only 5 or 0 .

I saw Uartprintf but its in stellaris. It didnt work for tiva c.

 

Waiting Helps

Thanks.

Share this post


Link to post
Share on other sites

You can use the UART Studio utility from TivaWare to send multiple bytes.

 

 

Now if you don't want, for some odd reason, to use uart studio.

The UART just sends 1 byte at a time. To send a string you need to send each byte at a time. There's a example in TivaWare called uart_echo. Remember to check TivaWare examples in TivaWare_C_Series-2.1.0.12573\examples. Chose your board and check them out

 

You need to use a function kinda like this, which is what basically the UART Studio has (it has more things, like see if it's a double, int, a window console printf)

//*****************************************************************************
//
// Send a string to the UART.
//
//*****************************************************************************
void
UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
    //
    // Loop while there are more characters to send.
    //
    while(ui32Count--)
    {
        //
        // Write the next character to the UART.
        //
        ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++);
    }
}

Share this post


Link to post
Share on other sites

Hi,

Two small observations:

a) UART Studio is a new name, original one is "uartstdio", -stdio comes from standard input-output.

B) UARTprintf provides formatted output only for integers, pointers, strings and chars, while floats or even doubles are avoided. 

L

Share this post


Link to post
Share on other sites

Hi,

Two small observations:

a) UART Studio is a new name, original one is "uartstdio", -stdio comes from standard input-output.

B) UARTprintf provides formatted output only for integers, pointers, strings and chars, while floats or even doubles are avoided. 

L

 

 

Doh!! i thought stdio was short for studio.

 

This changes everything, i must now go eat so i can take such new knowledge (i am not kidding) 

Share this post


Link to post
Share on other sites

Hi,

Today is still sunday, you have several hours to go out with/for girls, tomorrow wold be another good day to aquire new data....

L

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×