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

📄 uart.c

📁 USB测试程序
💻 C
字号:
#include		"config.h"



void uart0_init(uint32 bps)
{
	uint16	Fdiv;
	
    PINSEL0   &= ~(0x0F <<  4);                 // Clear the UART0 Function bits
    PINSEL0   |=  (0x01 <<  4);                 // Configure P0.2 for use with UART0 TxD
    PINSEL0   |=  (0x01 <<  6);  

    U0FCR = 0x07;								// Set the FIFO enable bit in the FCR register
    							   				//	This bit must be set for proper UART operation
    
    /* Set baudrate */    
	U0LCR=0x83;									// 8位数据传输,使能访问除数锁存器
	Fdiv=(Fpclk/16)/bps;
    U0DLL = Fdiv%256;
    U0DLM = Fdiv/256;
	U0LCR=0x03;									// 8 bit word length, 1 stop bit, No parity
    U0IER = 1; 									// Enable byte received interrupt
	
    VICIntSelect &= ~(1 << VIC_UART0);  				// IRQ on UART0
    VICVectPriority6 =  VIC_UART0; 						// Enable vector interrupt for UART0
    VICVectAddr6 = (uint32) uart0_handler;
    VICIntEnable |= (1 << VIC_UART0);    				// Enable UART 1 interrupt
}


void uart0_sendbyte()
{
	


}

void uart0_exception()
{
	





}

⌨️ 快捷键说明

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