C51 COMPILER V9.52.0.0   FU68XX_2_SYSTEM                                                   09/27/2018 15:36:27 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE FU68XX_2_SYSTEM
OBJECT MODULE PLACED IN .\Output\FU68xx_2_System.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\Library\FU68xx_Hardware_Driver\Source\FU68xx_2_System.c LARGE OMF2 WARNI
                    -NGLEVEL(0) BROWSE INCDIR(..\Library\FU68xx_Hardware_Driver\Include;..\User\Include) DEBUG PRINT(.\Listing\FU68xx_2_Syste
                    -m.lst) TABS(2) OBJECT(.\Output\FU68xx_2_System.obj)

line level    source

   1          /**************************** (C) COPYRIGHT 2017 Fortiortech shenzhen *****************************
   2          * File Name          : FU68xx_2_System.c
   3          * Author             : Javin.Liang,Fortiortech  Appliction Team
   4          * Version            : V1.0
   5          * Date               : 2018-9-26
   6          * Description        : This file contains the system function used for Motor Control.
   7          ***************************************************************************************************
   8          * All Rights Reserved
   9          **************************************************************************************************/
  10          /* Includes -------------------------------------------------------------------------------------*/
  11          #include <FU68xx_2.h>
  12          
  13          /* Flash Program Config--------------------------------------------------------------------------*/
  14          
  15          /*-------------------------------------------------------------------------------------------------
  16              Function Name : uint8 Flash_Sector_Erase(uint8 xdata *FlashAddress)
  17              Description   : 扇区自擦除: 指定将要擦除的Flash扇区，每个扇区128Byte，共128个扇
             -区，
  18                              扇区0~127对应Flash地址0x0000~0x3fff，通过指定Flash地址来指定要擦除
  19                              的Flash地址所在扇区。一次只能擦除一个扇区，自擦除数据为任意
             -值，一定
  20                              要在解锁后才给DPTR赋值。
  21              Input         : FlashAddress--Flash自擦除扇区内任意地址
  22              Output        : 0--Flash自擦除成功，1--Flash自擦除失败
  23          -------------------------------------------------------------------------------------------------*/
  24          uint8 Flash_Sector_Erase(uint8 xdata *FlashAddress)
  25          {
  26   1          bool TempEA;
  27   1      
  28   1          TempEA = EA;
  29   1          EA = 0;                            //Flash自擦除前先关总中断
  30   1      
  31   1          if(FlashAddress < 0x3f80)          // 不擦除最后一个扇区,0X3F80~0X3FFF
  32   1          {
  33   2              FLA_CR = 0x03;                 //使能自擦除
  34   2              FLA_KEY = 0x5a;
  35   2              FLA_KEY = 0x1f;                //flash预编程解锁
  36   2              _nop_();
  37   2              *FlashAddress = 0xff;          //写任意数据
  38   2              FLA_CR = 0x08;                 //开始预编程，完成后Flash再次上锁
  39   2          }
  40   1      
  41   1          EA = TempEA;                       //Flash自擦除后总中断恢复 
  42   1      
  43   1          if(ReadBit(FLA_CR, FLAERR))
  44   1          {
  45   2              return 1;
  46   2          }
  47   1          else
  48   1          {
  49   2              return 0;
  50   2          }
  51   1      }
C51 COMPILER V9.52.0.0   FU68XX_2_SYSTEM                                                   09/27/2018 15:36:27 PAGE 2   

  52          
  53          /*-------------------------------------------------------------------------------------------------
  54              Function Name : uint8 Flash_Sector_Write(uint8 xdata *FlashAddress, uint8 FlashData)
  55              Description   : Flash自烧写: 对扇区预编程和自擦除后，可以对扇区内的地址进行F
             -lash烧写，
  56                              一次烧写一个byte,一定要在解锁后才给DPTR赋值
  57              Input         : FlashAddress--Flash烧写地址
  58                              FlashData--Flash烧写数据
  59              Output        : 0--Flash自烧写成功，1--Flash自烧写失败
  60          -------------------------------------------------------------------------------------------------*/
  61          uint8 Flash_Sector_Write(uint8 xdata *FlashAddress, uint8 FlashData)
  62          {
  63   1          bool TempEA;
  64   1      
  65   1          TempEA = EA;                       //Flash自烧写前先关总中断
  66   1          EA = 0;
  67   1      
  68   1        if(FlashAddress < 0x3f80)            // 不编程最后一个扇区,0X3F80~0X3FFF
  69   1          {
  70   2              FLA_CR = 0x01;                 // 使能Flash编程
  71   2              FLA_KEY = 0x5a;
  72   2              FLA_KEY = 0x1f;                // flash预编程解锁
  73   2              _nop_();
  74   2              *FlashAddress = FlashData;     // 写编程数据
  75   2              FLA_CR = 0x08;                 // 开始预编程，完成后Flash再次上锁
  76   2          }
  77   1      
  78   1          EA = TempEA;                       //Flash自烧写后总中断恢复 
  79   1      
  80   1          if(ReadBit(FLA_CR, FLAERR))
  81   1          {
  82   2              return 1;
  83   2          }
  84   1          else
  85   1          {
  86   2              return 0;
  87   2          }
  88   1      }


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


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