adctimer.lst

来自「Example codes for ADuC842 CPU family」· LST 代码 · 共 91 行

LST
91
字号
C51 COMPILER V7.07   ADCTIMER                                                              03/30/2004 13:14:22 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE ADCTIMER
OBJECT MODULE PLACED IN ADCTIMER.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ADCTIMER.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          : ADCtimer.c
   8          
   9           Hardware      : ADuC842
  10          
  11           Description   : Performs ADC conversions at 10KSPS in Timer2 mode.
  12                           P3.3 indicates convesion complete. Continuously
  13                           flashes LED (independently of ADC routine) at
  14                           approximately 4.7Hz.
  15                           All rate calculations assume an 2.097152MHz Mclk.
  16                          
  17          ********************************************************************/
  18          
  19          #include<stdio.h>
  20          #include<aduc842.h>
  21          
  22          sbit    adcled = 0x0B3  ;
  23          sbit    LED = 0x0B4;            //P3.4 drives red LED on eval board 
  24          
  25          void adc_int() interrupt 6{
  26   1                      adcled ^= 1;
  27   1                      return;
  28   1                                }                                           
  29          void DELAY(int);
  30          void main(void)
  31          {
  32   1      
  33   1      int CHAN=0;
  34   1      /*PRECONFIGURE...*/
  35   1      ADCCON1 = 0x09E;                // power up ADC & enable Timer2 mode
  36   1      ADCCON2 = 3;                    // select channel to convert
  37   1      RCAP2L  = 0x0F6;                //sample period = 2 * T2 reload prd
  38   1      RCAP2H  = 0x0FF;                //  = 2*(10000h-FFF6h)*5.722us
  39   1      TL2     = 0x0F6;                //  = 2*9*5.722us
  40   1      TH2     = 0x0FF;                //   = 102.99us
  41   1      
  42   1      /*LAUNCH Timer2 DRIVEN CONVERSIONS...*/
  43   1      EA      = 1;                    // enable interrupts
  44   1      EADC    = 1;                    // enable ADC interrupt
  45   1      TR2     = 1;                    // run Timer2
  46   1      
  47   1      /*CONTINUE WITH OTHER CODE...*/
  48   1      for (;;)
  49   1      {
  50   2      LED ^= 1;
  51   2      DELAY(1500);
  52   2      }
  53   1      
  54   1      /*; the micro is free to continue with other tasks (flashing the LED in
  55   1       this case) while the ADC operation is being controlled by Timer2
C51 COMPILER V7.07   ADCTIMER                                                              03/30/2004 13:14:22 PAGE 2   

  56   1       and the ADC interrupt service routine.*/
  57   1      
  58   1      }
  59          
  60          void DELAY(int length)
  61          {
  62   1      while (length >=0)
  63   1          {length--;}
  64   1      }
  65          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     69    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       2
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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