C51 COMPILER V9.54   UART                                                                  12/03/2024 14:58:48 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN .\Objects\uart.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE public\uart.c OPTIMIZE(8,SPEED) BROWSE INCDIR(.\public) DEBUG OBJECTEXTE
                    -ND PRINT(.\Listings\uart.lst) OBJECT(.\Objects\uart.obj)

line level    source

   1          #include "uart.h"
   2          
   3          
   4          void Uart_Init(void)
   5          {
   6   1              SYSCON |= 0xC0;//系统时钟不分频
   7   1              CKCON = 0x00;   
   8   1              P2CR &= 0xFC;
   9   1              P2CR |= 0x04;
  10   1              ALFSEL1 = 0x03;//串口复用
  11   1      
  12   1              /********BAUD SET 9600*********/
  13   1              //BAUD = F/(16*(32768-SBRT)+SFINE)
  14   1              SBRTH = 0xFF;
  15   1              SBRTL = 0xe6;
  16   1              SFINE = 0x01;           //波特率发生器微调数据寄存器
  17   1              SCON = 0x50;            //选择方式1
  18   1              
  19   1              
  20   1      }
  21          
  22          /*发送一个字节*/
  23          void sendChar(uint8_t TxChar)
  24          {
  25   1              SBUF = TxChar;
  26   1      }
  27          
  28          /*发送一个字符串*/
  29          void sendString(uint8_t *TxStr)
  30          {
  31   1              while((*TxStr) != '\0') //如果字符不为’\0’，继续发送
  32   1              {
  33   2                      sendChar(*TxStr);                       //发送当前字符串指针指向的字符；
  34   2                      TxStr++;                                                        //字符串指针加1
  35   2              }
  36   1      }
  37          
  38          /*
  39          将收到的数据发送出来
  40          */
  41          void Uart_Test(void)
  42          {
  43   1              Uart_Init();
  44   1              IEN0 = 0x90; //开启uart中断
  45   1              
  46   1              
  47   1              while(1)
  48   1              {
  49   2                      ;
  50   2              }
  51   1      }
  52          


C51 COMPILER V9.54   UART                                                                  12/03/2024 14:58:48 PAGE 2   

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     58    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
