• 博客(0)
  • 资源 (1)

空空如也

深入浅出ARM7-LPC213X_214X

AM7开发板的引脚介绍及相关程序 如:void UART0_Init (void) { uint16 Fdiv; PINSEL0 = (PINSEL0&(~0x0f))|0x00000005; // 设置I/O连接到UART0 U0IER = 0x01;// 允许RBR中断,即接收中断 U0LCR = 0x83; // DLAB=1,允许设置波特率 Fdiv = (Fosc / 16) / UART_BPS; // 设置波特率 U0DLM = Fdiv / 256; U0DLL = Fdiv % 256; U0LCR = 0x03; // IRQEnable(); } uint8 UART0_GetByte (void) { uint8 rcv_dat; while ((U0LSR & 0x01) == 0); rcv_dat = U0RBR; return (rcv_dat); } void UART0_GetStr (uint8 *s, uint32 n) { for ( ; n>0; n--) { *s++ = UART0_GetByte(); } } void UART0_SendByte (uint8 dat) { U0THR = dat; while ((U0LSR & 0x40) == 0); // 等待数据发送完毕 } void UART0_SendStr (uint8 const *str) { while (1) { if (*str == '\0') break; // 遇到结束符,退出 UART0_SendByte(*str++); // 发送数据 } }

2011-07-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除