C51 COMPILER V9.52.0.0   UARTINIT                                                          09/28/2018 15:44:26 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE UARTINIT
OBJECT MODULE PLACED IN .\Output\UARTInit.obj
COMPILER INVOKED BY: F:\keil\C51\BIN\C51.EXE ..\User\Source\Hardware\UARTInit.c LARGE OMF2 WARNINGLEVEL(0) BROWSE INCDIR
                    -(..\Library\FU68xx_Hardware_Driver\Include;..\User\Include) DEBUG PRINT(.\Listing\UARTInit.lst) OBJECT(.\Output\UARTInit
                    -.obj)

line level    source

   1          /**************************** (C) COPYRIGHT 2017 Fortiortech shenzhen *****************************
   2          * File Name          : UARTInit.c
   3          * Author             : Vina Peng,Fortiortech  Appliction Team
   4          * Version            : V1.0
   5          * Date               : 10-Apr-2017
   6          * Description        : This file contains UART initial function used for Motor Control.
   7          ***************************************************************************************************
   8          * All Rights Reserved
   9          **************************************************************************************************/
  10          #include <FU68xx_2.h>
  11          #include <Myproject.h>
  12          /* Private variables ----------------------------------------------------------------------------*/
  13          MCUART Uart;
  14          
  15          void UART_Init(void)
  16          {
  17   1          SetBit(PH_SEL, UARTEN);     //UART使能,使用默认端口p0[6]as UART_RXD; p0[5]as UART_TXD
  18   1          UT_MOD1 = 0;
  19   1          UT_MOD0 = 1;                //8bit波特率可变UART模式
  20   1          SM2 = 0;                    //禁止Mode2和Mode3多机通讯
  21   1          REN = 1;                    //使能接收
  22   1          ES0 = 0;                    //先关中断
  23   1      
  24   1          PUART1=0;                   //中断优先级时最低
  25   1          PUART0=0;
  26   1      
  27   1          UT_BAUD =0x0c;              //default baudrate:9600-0x9b,1200-0x4E1,115200-0x0c
  28   1          ES0 = 0;                    //发送/接受中断使能
  29   1      }
  30          void UartTxdate(uint16* sndBuf, int32 len)
  31          {
  32   1          uint16 i=0;
  33   1        for(i=0;i<len;i++)
  34   1          {
  35   2            UART_SendData(*sndBuf++);
  36   2          }
  37   1      }
  38          void UART_SendData(unsigned char T_Data)
  39          {
  40   1          UT_DR = T_Data;
  41   1          while(!(TI==1));        //等待发送完成
  42   1          TI = 0;                 //发送完成中断标志位清零
  43   1      }
  44          
  45          /*-------------------------------------------------------------------------------------------------
  46              Function Name :     void SendDataByUart(void)
  47              Description   :     UART发送一个int型变量
  48              Input         :     int型变量
  49              Output                              :       无
  50          -------------------------------------------------------------------------------------------------*/
  51          void SendDataByUart(int in_show)
  52          {
  53   1              unsigned char show_result[5];
C51 COMPILER V9.52.0.0   UARTINIT                                                          09/28/2018 15:44:26 PAGE 2   

  54   1              
  55   1              if(in_show < 0)
  56   1              {
  57   2                      in_show = -in_show;
  58   2                      UT_DR = '-';    
  59   2                      while(!TI);
  60   2                      TI = 0;
  61   2              }
  62   1              
  63   1        show_result[0] = in_show / 10000;
  64   1        show_result[1] = in_show / 1000 % 10;
  65   1        show_result[2] = in_show / 100 % 10;
  66   1        show_result[3] = in_show / 10 % 10;
  67   1        show_result[4] = in_show % 10;
  68   1      
  69   1              UT_DR = show_result[0] + '0';   
  70   1              while(!TI);
  71   1              TI = 0;
  72   1              UT_DR = show_result[1] + '0';   
  73   1              while(!TI);
  74   1              TI = 0;
  75   1              UT_DR = show_result[2] + '0';   
  76   1              while(!TI);
  77   1              TI = 0;
  78   1              UT_DR = show_result[3] + '0';   
  79   1              while(!TI);
  80   1              TI = 0;
  81   1              UT_DR = show_result[4] + '0';   
  82   1              while(!TI);
  83   1              TI = 0;
  84   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    329    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =     57      14
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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