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

📄 analog.lst

📁 web51代码
💻 LST
字号:
C51 COMPILER V8.05a   ANALOG                                                               05/16/2007 11:29:10 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE ANALOG
OBJECT MODULE PLACED IN ANALOG.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE ANALOG.C LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //-----------------------------------------------------------------------------
   2          // Net ANALOG.C
   3          //
   4          // This module handles the analog inputs which are external temperature
   5          // sensor, the on-chip temperature sensor, and operating voltage.
   6          //-----------------------------------------------------------------------------
   7          #include <string.h>
   8          #include <stdlib.h>
   9          #include <stdio.h>
  10          #include <reg52.h>
  11          #include "net.h"
  12          #include "serial.h"
  13          #include "analog.h"
  14          #include <intrins.h>
  15                  sbit adclk=P1^5;
  16                  sbit addata=P1^6;
  17                  sbit adcs=P1^7;
  18          #define uchar unsigned char
  19          #define uint  unsigned int
  20          extern char xdata text[];
  21          UINT idata cpu_temperature, air_temperature, cpu_voltage;
  22          UCHAR idata mux_select;
  23          
  24          /*********TLC549子程序***********************/
  25          unsigned char ad(void)            //TLC549的采样子程序
  26          {
  27   1          unsigned char i,sample_data;
  28   1              bit ea_flag;
  29   1      
  30   1          ea_flag=EA;
  31   1          EA=0;
  32   1          adcs=0;
  33   1          _nop_();
  34   1          _nop_();
  35   1          if(addata==1)
  36   1          {
  37   2              sample_data=1;
  38   2          }
  39   1          else
  40   1          {
  41   2              sample_data=0;
  42   2          }
  43   1          for(i=0;i<7;i++)
  44   1          {
  45   2              sample_data=(sample_data<<1);
  46   2              adclk=1;
  47   2              _nop_();
  48   2              _nop_();
  49   2              adclk=0;
  50   2              if(addata==1)
  51   2              {
  52   3                  sample_data=(sample_data|0x01);
  53   3              }
  54   2          }
  55   1          adclk=1;
C51 COMPILER V8.05a   ANALOG                                                               05/16/2007 11:29:10 PAGE 2   

  56   1          _nop_();
  57   1          _nop_();
  58   1          adclk=0;
  59   1          _nop_();
  60   1          _nop_();
  61   1          
  62   1          adcs=1;
  63   1          EA=ea_flag;
  64   1          return sample_data;
  65   1      
  66   1      }
  67          //--------------------------------------------------------------------------
  68          // This function is a little state machine which reads one analog
  69          // inputs at a time, out of the 3 possible inputs
  70          //  1. On-chip temperature
  71          //  2. External air temperature
  72          //  3. CPU operating voltage
  73          //--------------------------------------------------------------------------
  74          void read_analog_inputs(void)
  75          {
  76   1         cpu_temperature=2500;
  77   1         air_temperature=(uint)ad()*19;
  78   1         cpu_voltage=50;
  79   1      }
  80           
  81          


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


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

⌨️ 快捷键说明

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