Jump to content
43oh

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.

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++);
    }
}
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

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) 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...