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

📄 ticrtc.lst

📁 Example codes for ADuC842 CPU family
💻 LST
字号:
C51 COMPILER V7.04   TICRTC                                                                09/30/2003 11:22:36 PAGE 1   


C51 COMPILER V7.04, COMPILATION OF MODULE TICRTC
OBJECT MODULE PLACED IN ticrtc.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ticrtc.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //********************************************************************
   2          //
   3          // Author        : ADI - Apps            www.analog.com/MicroConverter
   4          //
   5          // Date          : October 2003
   6          //
   7          // File          : TIC.c
   8          //
   9          // Hardware      : ADuC842/ADuC843
  10          //
  11          // Description   : Demonstrates the use of the Time Interval Counter as
  12          //                                 a 24 hour Real Time Clock. The program asks the user to provide
  13          //                                 the current time and prints out the time every 10 seconds                                    
  14          //********************************************************************
  15          
  16          #include <stdio.h> 
  17          #include <ADuC842.h>
  18          
  19          sbit LED = 0x0B4;
  20          
  21          void DELAY(int);
  22          void TIC_int () interrupt 10
  23          {
  24   1              LED ^= 1;
  25   1              TIMECON = 0x53;         // clear TII bit
  26   1              
  27   1      }
  28          
  29          void main (void)
  30          {
  31   1              int temp_hour,temp_min,temp_sec;
  32   1              char answer;
  33   1              //Configure the baud rate 9600
  34   1              T3CON = 0x83;
  35   1              T3FD  = 0x2D;
  36   1              SCON  = 0x52;
  37   1              
  38   1      
  39   1              printf("\nThe time is now %02BD:%02BD:%02BD\n",HOUR,MIN,SEC);
  40   1              printf("Do you wish to change the time? Y/N\n");
  41   1              scanf("%c",&answer);
  42   1      
  43   1              if (answer=='Y')
  44   1              {
  45   2                      printf("\nEnter the current time in Hours:Mins:Seconds, then press a key to continue\n");
  46   2                      scanf("%d:%d:%d",&temp_hour,&temp_min,&temp_sec);
  47   2              
  48   2                      TIMECON = 0x01; 
  49   2                      SEC = temp_sec;
  50   2                      MIN = temp_min;
  51   2                      HOUR = temp_hour;
  52   2              }
  53   1      //Configure Time Interval Counter  
  54   1              INTVAL = 0x0A;    // 10 seconds
  55   1          TIMECON = 0x53;   // configure the Time Interval Counter to count seconds in clock mode
C51 COMPILER V7.04   TICRTC                                                                09/30/2003 11:22:36 PAGE 2   

  56   1      
  57   1      //Configure External Interrupt
  58   1              IEIP2 = 0xA4;   // enable TIC interrupt
  59   1          EA = 1;                     // enable interrupts
  60   1      
  61   1              while (1)
  62   1              {
  63   2              printf("\nThe time is now %02BD:%02BD:%02BD\n",HOUR,MIN,SEC);
  64   2              DELAY(1700);    // wait for tx to complete
  65   2              PCON = 0x22;    // power down mode
  66   2              }
  67   1      }
  68          
  69          void DELAY(int length)
  70          {
  71   1      while (length >=0)
  72   1          length--;
  73   1      }


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


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

⌨️ 快捷键说明

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