在线时间101 小时
UID288887
注册时间2011-5-8
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 491
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2014-11-28 16:33:22
|
显示全部楼层
代码都是参照 官方例程的
char ch;
#ifdef CMSIS // If we are conforming to CMSIS, we need to call start here
start();
#endif
printf("\n\rRunning the DEBUG1 project.\n\r");
while(1)
{
ch = in_char();
out_char(ch);
}
if (TERM_PORT_NUM == 0)
{
// /* Enable the pins for the selected UART */
//#ifdef FREEDOM
// /* Enable the UART_TXD function on PTA1 */
PORTA_PCR1 = PORT_PCR_MUX(0x2); //lonny use
//
// /* Enable the UART_TXD function on PTA2 */
PORTA_PCR2 = PORT_PCR_MUX(0x2); //lonny use
char
in_char (void)
{
if (TERM_PORT_NUM == 0)
return uart0_getchar(UART0_BASE_PTR);
else if (TERM_PORT_NUM == 1)
return uart_getchar(UART1_BASE_PTR);
else
return uart_getchar(UART2_BASE_PTR);
}
/********************************************************************/
void
out_char (char ch)
{
if (TERM_PORT_NUM == 0)
uart0_putchar(UART0_BASE_PTR, ch);
else if (TERM_PORT_NUM == 1)
uart_putchar(UART1_BASE_PTR, ch);
else
uart_putchar(UART2_BASE_PTR, ch);
}
|
|