分类: 嵌入式
2016-06-06 23:04:40
序号 |
寄存器 |
地址 |
作用 |
寄存器位定义 |
1 |
ULCON0 |
0xE290_0000 |
UART0 Line控制寄存器 |
ULCON0[6]=Infrared Mode ULCON0[5:3]=Parity Mode ULCON0[2]= Number of Stop Bit ULCON0[1:0]=Word Length |
2 |
UCON0 |
0xE290_0004 |
UART0控制寄存器 |
UCON0[20]= Tx DMA Burst Size UCON0[16]= Rx DMA Burst Size UCON0[10]=Clock Selection UCON0[9]=Tx Interrupt Type UCON0[8]=Rx Interrupt Type UCON0[7]=Rx Time Out Enable UCON0[6]=Rx Error Status Interrupt Enable UCON0[5]= Loop-back Mode UCON0[4]=Send Break Signal UCON0[3:2]= Tx Mode UCON0[1:0]= Rx Mode |
3 |
UFCON0 |
0xE290_0008 |
UART0 FIFO控制寄存器 |
UFCON0[10:8]= Tx FIFO Trigger Level UFCON0[6:4]= Rx FIFO Trigger Level UFCON0[2]= Tx FIFO Reset UFCON0[1]= Rx FIFO Reset UFCON0[0]= FIFO Enable |
4 |
UMCON0 |
0xE290_000C |
UART0 Modem控制寄存器 |
UMCON0[7:5]= RTS Trigger Level UMCON0[4]= Auto Flow Control (AFC) UMCON0[3]=Modem Interrupt Enable UMCON0[0]=Request to Send |
5 |
UTRSTAT0 |
0xE290_0010 |
UART0 Tx/Rx状态寄存器 |
UTRSTAT0[2]= Tx Buffer & Tx shifter empty UTRSTAT0[1]= Tx Buffer empty UTRSTAT0[0]= Rx Buffer data ready |
6 |
UERSTAT0 |
0xE290_0014 |
UART0 Error 状态寄存器 |
UERSTAT0[3]=Break Detect UERSTAT0[2]=Frame Error UERSTAT0[1]=Parity Error UERSTAT0[0]=Overrun Error |
7 |
UFSTAT0 |
0xE290_0018 |
UART0 FIFO 状态寄存器 |
UFSTAT0[24]= Tx FIFO Full UFSTAT0[23:16]= Tx FIFO Count UFSTAT0[9]= Rx FIFO Error UFSTAT0[8]= Rx FIFO Full UFSTAT0[7:0]= Rx FIFO Count |
8 |
UMSTAT0 |
0xE290_001C |
UART0 Modem状态寄存器 |
UMSTAT0[4]= Delta CTS UMSTAT0[0]=Clear to Send |
9 |
UTXH0 |
0xE290_0020 |
UART0 Tx Buffer寄存器 |
UTXH0[7:0]=Tx data for UART0 |
10 |
URXH0 |
0xE290_0024 |
UART0 Rx Buffer寄存器 |
URXH0[7:0]=Rx data for UART0 |
11 |
UBRDIV0 |
0xE290_0028 |
UART0 Baud Rate寄存器 |
UBRDIV0[15:0] =Baud Rate Division Value |
12 |
UDIVSLOT0 |
0xE290_002C |
UART0 Dividing Slot寄存器 |
UDIVSLOT0[15:0]= Select Divider Slot |
13 |
UINTP0 |
0xE290_0030 |
UART0 Interrupt Pending寄存器 |
UINTP0[3]= Modem Interrupt UINTP0[2]= Tx Interrupt UINTP0[1]= Error Interrupt UINTP0[0]= Rx Interrupt |
14 |
UINTSP0 |
0xE290_0034 |
UART0 Interrupt Source Pending寄存器 |
UINTSP0[3]= Modem Interrupt UINTSP0[2]= Tx Interrupt UINTSP0[1]= Error Interrupt UINTSP0[0]= Rx Interrupt |
15 |
UINTM0 |
0xE290_0038 |
UART0 Interrupt Mask寄存器 |
UINTM0[3]= Modem Interrupt UINTM0[2]= Tx Interrupt UINTM0[1]= Error Interrupt UINTM0[0]= Rx Interrupt |
|
3 UART0的实例代码
代码分为3个部分:UART0的初始化,UART0的发送一个字符,UART0的接收一个字符。
初始化的步骤包括:
1.设置GPIOA0_0为UART0的接收管脚RxD0,GPIOA0_1为UART0的接收管脚TxD0
2.设置UART0的寄存器,确定数据方式如Normal Mode;No Parity;one stop bit;8-bit data
3.设置UART0的波特率为115200
点击(此处)折叠或打开