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

📄 adctimer.lst

📁 关于aduc841单片机的一些实用入门程序
💻 LST
字号:
C51 COMPILER V7.04   ADCTIMER                                                              09/29/2003 17:22:33 PAGE 1   


C51 COMPILER V7.04, 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      : ADuC841
  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 10Hz.
  15                           All rate calculations assume an 11.0592MHz crystal
  16                          
  17          ********************************************************************/
  18          
  19          #include<stdio.h>
  20          #include<aduc841.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 = CHAN ;                // select channel to convert
  37   1      RCAP2L  = 0x0D2;                //sample period = 2 * T2 reload prd
  38   1      RCAP2H  = 0x0FF;                
  39   1      TL2     = 0x0D2;                
  40   1      TH2     = 0x0FF;                
  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(3200);
  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.04   ADCTIMER                                                              09/29/2003 17:22:33 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        =     64    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   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 + -