Printf -> UART3

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Printf -> UART3

246 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Albert on Sat Mar 26 05:48:27 MST 2011
Hi all,

Somebody know how use the printf function to send data for the UART3 port? or for other function?

Thanks.
0 Kudos
2 Replies

221 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Albert on Sat Mar 26 06:57:47 MST 2011
Hi Zero,

I was using the code:

unsigned char UART_BUFFER[16];
unsigned char qt;

qt=sprintf(UART_BUFFER,"tes %u",32);
UART0_Sendchar(UART_BUFFER,qt);

Your solution is smarter.

Thanks,
0 Kudos

221 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Mar 26 06:11:27 MST 2011
Are we still talking about LPC17xx?

1. #include <stdio.h>

2. Setup UARTx

3. Include this function:
//set for printf
int __write (int iFileHandle, char *pcBuffer, unsigned char iLength)
{
 unsigned int i;
 for (i = 0; i<iLength; i++)
 {
  UART0_Sendchar(pcBuffer);    //print character
 }
 return iLength;
}


so printf is using UART0_Sendchar..

See:

http://support.code-red-tech.com/CodeRedWiki/UartPrintf
0 Kudos