Printf -> UART3

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Printf -> UART3

745件の閲覧回数
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 件の賞賛
返信
2 返答(返信)

720件の閲覧回数
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 件の賞賛
返信

720件の閲覧回数
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 件の賞賛
返信