<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                UART裸機驅動設計主要在于配置各寄存器的值; 開發板型號: TX2440; UART 使能: 使能UART0; 傳 輸 參 數: 8位數據位,1位停止位,無奇偶校驗,波特率115200; 時 鐘 參 數: UART使用系統的 PCLK. ~~~ /******************************************************************* *版權所有(C)2015,ZJU * *文件名稱:uart.c *內容摘要:關于UART的配置 *其它說明:開發板型號:TX2440 * UART0:RXD0 -- GPH3 , TXD0 -- GPH2 *當前版本:V1.0 *作 者:Frank *完成日期:2015.12.14 * *******************************************************************/ #define GPHCON (*(volatile unsigned long *)0x56000070) //Configures the pins of port H #define ULCON0 (*(volatile unsigned long *)0x50000000) //UART channel 0 line control register #define UCON0 (*(volatile unsigned long *)0x50000004) //UART channel 0 control register #define UTRSTAT0 (*(volatile unsigned long *)0x50000010) //UART channel 0 Tx/Rx status register #define UTXH0 (*(volatile unsigned long *)0x50000020) //UART channel 0 transmit buffer register #define URXH0 (*(volatile unsigned long *)0x50000024) //UART channel 0 receive buffer register #define UBRDIV0 (*(volatile unsigned long *)0x50000028) //Baud rate divisior register 0 #define PCLK 50000000 //PCLK=50M (start.S中設置了 FCLK:HCLK:PCLK = 1:4:8, FCLK=400M) #define BAUD 115200 /******************************************************************* *函數名稱:Uart_Init() *功能描述:UART初始化函數 *其他說明: *創建日期:2015.12.14 *******************************************************************/ void Uart_Init(void) { /*配置引腳功能*/ GPHCON &= (~(0xf << 4)); GPHCON |= (0xa << 4); //GPH2設為TXD0,GPH3設為RXD0 /*設置數據格式*/ ULCON0 = 0b11; //8位數據位,1位停止位,無奇偶校驗 /*設置工作模式*/ UCON0 = 0b0101; //發送和接收均采用輪詢方式 /*設置波特率*/ UBRDIV0 = (int)(PCLK/(BAUD*16) - 1); //波特率設置為115200 } /******************************************************************* *函數名稱:Puts() *功能描述:字符發送函數 *輸入形參:ch *返 回 值:無 *其他說明:ch為需要發送的字符 *創建日期:2015.12.14 *******************************************************************/ void Puts(unsigned char ch) { while (!(UTRSTAT0 & (1 << 2))); UTXH0 = ch; } /******************************************************************* *函數名稱:Gets() *功能描述:字符接收函數 *輸入形參:無 *返 回 值:ch *其他說明:ch為接收到的字符 *創建日期:2015.12.14 *******************************************************************/ unsigned char Gets(void) { char ch; while (!(UTRSTAT0 & (1 << 0))); ch = URXH0; return ch; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看