C51 COMPILER V8.02   12C5A串口                                                             09/04/2013 10:42:59 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE 12C5A串口
OBJECT MODULE PLACED IN 12c5a串口.OBJ
COMPILER INVOKED BY: E:\elecfans.com_Keil uVision3\C51\BIN\C51.EXE 12c5a串口.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <STC12C5A60S2.h>
   2          #define uint unsigned int
   3          #define uchar unsigned char
   4          #include <string.h>
   5          sbit qd=P2^0;
   6          void delay(unsigned int cnt);
   7          void UART_init (void)
   8          { EA = 1;
   9   1       ES = 1;
  10   1        PCON |= 0x80;  //使能波特率倍速位SMOD 
  11   1        SCON = 0x50;  //8位数据,可变波特率
  12   1         AUXR |= 0x40;  //定时器1时钟为Fosc,即1T 
  13   1         AUXR &= 0xfe;  //串口1选择定时器1为波特率发生器 
  14   1         TMOD &= 0x0f;  //清除定时器1模式位 
  15   1         TMOD |= 0x20;  //设定定时器1为8位自动重装方式 
  16   1         TL1 = 0xFA;  //设定定时初值 
  17   1         TH1 = 0xFA;  //设定定时器重装值 
  18   1         ET1 = 0;  //禁止定时器1中断 
  19   1         TR1 = 1;  //启动定时器1
  20   1         }      //设置串口通讯的波特率，这里设置的是115200，11.0592晶振
  21          void UART_R (void) interrupt 4  using 1
  22          {   
  23   1      unsigned char UART_data;  
  24   1       RI = 0;     
  25   1       UART_data = SBUF; 
  26   1        }
  27            //设置串口中断函数
  28            void UART_T (unsigned char UART_data)
  29            {
  30   1           SBUF = UART_data;
  31   1                  while(TI == 0);  
  32   1                      TI = 0;
  33   1         }//串口发送字符函数
  34          void UART_TC (unsigned char *str)
  35          {
  36   1        while(*str != '\0')
  37   1       {  
  38   2         UART_T(*str); 
  39   2           *str++; 
*** WARNING C275 IN LINE 39 OF 12C5A串口.C: expression with possibly no effect
  40   2       } 
  41   1                *str = 0;
  42   1       }      //串口发送字符串函数
  43           void main (void)
  44           {
  45   1         UART_init();
  46   1         while(1) 
  47   1         { 
  48   2        // if(qd==0)
  49   2         //{
  50   2         //delay(10000);
  51   2         //if(qd==0)
  52   2         UART_TC("pl0 sq1 sm100\r");
  53   2        // UART_TC("\r");
  54   2      
C51 COMPILER V8.02   12C5A串口                                                             09/04/2013 10:42:59 PAGE 2   

  55   2         delay(90000000000000000000000000000);
  56   2         //UART_TC("#0P1500\r");
  57   2         //UART_TC("#0P1500T500\r");
  58   2         //delay(9000000000000000000000000000);
  59   2         }
  60   1      }//，***表示需要发送的字符串,
  61          void delay(unsigned int cnt)
  62          {
  63   1       while(--cnt);
  64   1      }
  65          
  66          
  67          


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


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