⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart_main.c

📁 LPC2468串口驱动
💻 C
字号:
/*****************************************************************************
 *   uarttest.c:  main C entry file for NXP LPC23xx Family Microprocessors
 *
 *   Copyright(C) 2006, NXP Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2006.07.13  ver 1.00    Prelimnary version, first Release
 *
******************************************************************************/
#include "LPC24xx.h"                        /* LPC23xx/24xx definitions */
#include "type.h"
#include "irq.h"
#include "..\uart_src\uart.h"	 
#include "stdio.h"
#include "string.h"
#include "timer.h"
#include "target.h"

extern volatile DWORD UART0Count;
extern volatile BYTE UART0Buffer[BUFSIZE];
extern volatile DWORD UART1Count;
extern volatile BYTE UART1Buffer[BUFSIZE];


/*****************************************************************************
**   Main Function  main()
*****************************************************************************/
int main (void)
{
	init_timer(0,TIME_INTERVAL);

    PINSEL1 = 0x00000000;

    UARTInit(0, 9600);	/* uart0设置 */
	UARTInit(1, 9600);	/* uart1设置 */

  while (1) 
  {			
	if ( UART0Count != 0 )
	{
	  U0IER = IER_THRE | IER_RLS;			/* Disable RBR */
	  UARTSend( 0, (BYTE *)UART0Buffer, UART0Count );
	  UART0Count = 0;
	  U0IER = IER_THRE | IER_RLS | IER_RBR;	/* Re-enable RBR */
	}
	if ( UART1Count != 0 )
	{
	  U1IER = IER_THRE | IER_RLS;			/* Disable RBR */
	  UARTSend( 1, (BYTE *)UART1Buffer, UART1Count );
	  UART1Count = 0;
	  U1IER = IER_THRE | IER_RLS | IER_RBR;	/* Re-enable RBR */
	}
  }
  return 0;
}

/*****************************************************************************
**                            End Of File
*****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -