⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_api.lst

📁 C51 API 例子源码
💻 LST
字号:
C51 COMPILER V7.10   TEST_API                                                              06/11/2004 10:54:19 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE TEST_API
OBJECT MODULE PLACED IN test_api.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE test_api.c BROWSE INCDIR(.\;.\c51/) DEFINE(KEIL) DEBUG OBJECTEXTEND TABS(3)

line level    source

   1          /*C**************************************************************************
   2          * NAME:         test_api.c
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2004 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:            
   7          * REVISION:     1.0     
   8          *----------------------------------------------------------------------------
   9          * PURPOSE: 
  10          * 
  11          *****************************************************************************/
  12          
  13          /*_____ I N C L U D E S ____________________________________________________*/
  14          #include "flash_eeprom_api.c"
  15          
  16          /*_____ M A C R O S ________________________________________________________*/
  17          
  18          /*_____ D E F I N I T I O N ________________________________________________*/
  19          
  20          /*_____ D E C L A R A T I O N ______________________________________________*/
  21          
  22          
  23          
  24          /*F**************************************************************************
  25          * NAME: main 
  26          *----------------------------------------------------------------------------
  27          * PARAMS:
  28          *----------------------------------------------------------------------------
  29          * PURPOSE: 
  30          *----------------------------------------------------------------------------
  31          * EXAMPLE:
  32          *----------------------------------------------------------------------------
  33          * NOTE: 
  34          *----------------------------------------------------------------------------
  35          * REQUIREMENTS: 
  36          *****************************************************************************/
  37          void main (void)
  38          {
  39   1      int adress;
  40   1      char i=0;
  41   1      char data_tmp;
  42   1      
  43   1      /* write code page example */
  44   1      for(adress=0x0000;adress<0x007F;adress++)
  45   1      {
  46   2      *((unsigned char xdata*) adress)=0x55;    /* write 0x55 between 0x0000 and 0x007F of xram */
  47   2      }
  48   1      __api_wr_code_page(0x1100,0x0000,0x7F);   /* copy xram page to flash at 0x1100 */
  49   1      
  50   1      /* write code byte example */
  51   1      i=0;
  52   1      for(adress=0x1000;adress<0x1006;adress++)
  53   1      {
  54   2         __api_wr_code_byte(adress,0x41+i++);   /* write "ABCDEF" at 0x1000 */
  55   2      }
C51 COMPILER V7.10   TEST_API                                                              06/11/2004 10:54:19 PAGE 2   

  56   1      
  57   1      /* read and write code byte example */
  58   1      for(adress=0x1000;adress<0x1006;adress++)
  59   1      {
  60   2      /* copy 0x1000-0x1006 to 0x1010-0x1016 in flash memory */
  61   2         data_tmp = __api_rd_code_byte(adress);
  62   2         __api_wr_code_byte(adress+0x0010,data_tmp);
  63   2      }
  64   1      
  65   1      #ifdef ONCHIP_EEPROM
  66   1      
  67   1      /* write eeprom byte example */
  68   1      i=0;
  69   1      for (adress=0x000;adress<0x400;adress++)  /* write 1Ko of eeprom */
  70   1      {
  71   2         __api_wr_eeprom_byte(adress,i++);      /* write a byte, write time = 10ms to 20ms */
  72   2      }
  73   1      
  74   1      /* read eeprom byte example */
  75   1      for (adress=0x000;adress<0x400;adress++)
  76   1      {
  77   2      /* copy previous writed data from eeprom to flash at 0x1200 */
  78   2         data_tmp=__api_rd_eeprom_byte(adress);
  79   2         __api_wr_code_byte(0x1200+adress,data_tmp);
  80   2      }
  81   1      
  82   1      #endif
  83   1      while(1);                                 /* endless */
  84   1      
  85   1      }
  86          
  87          
  88          
  89          
  90          
  91          
  92          
  93          
  94          
  95          
  96          
  97          
  98          
  99          
 100          
 101          
 102          
 103          
 104          
 105          
 106          
 107          
 108          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    356    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       7
   IDATA SIZE       =   ----    ----
C51 COMPILER V7.10   TEST_API                                                              06/11/2004 10:54:19 PAGE 3   

   BIT SIZE         =   ----       4
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -