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

📄 508.lst

📁 这是从网上下载修改LED点光源上用的七彩同步源程序
💻 LST
字号:
C51 COMPILER V6.12  508                                                                    03/05/2009 17:11:16 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE 508
OBJECT MODULE PLACED IN .\508.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\508.c DEBUG OBJECTEXTEND

stmt level    source

   1          // Night Lamp Saver V3.2
   2          // PIC12C508 LP Xtal 32768Hz runs saver.c
   3          // The SAVER.C was compiled by PCW PIC C Compiler V2.266
   4          // March 6,1999
   5          // Copyright(C) 1999 W.SIRICHOTE
   6          
   7          
   8          #include <12C508.H>
*** ERROR 318 IN LINE 8 OF .\508.c: can't open file '12C508.H'
   9          #fuses LP,NOPROTECT,NOWDT // must include this line !!
*** ERROR 315 IN LINE 9 OF .\508.c: unknown #directive 'fuses'
  10          
  11          // installation test 1 min turn on
  12          #define onHour1   8
  13          #define onMin1    0
  14          #define offHour1  8
  15          #define offMin1   1
  16          
  17          // daily on/off, say 19:00 to 22:00
  18          #define onHour2   19
  19          #define onMin2    0
  20          #define offHour2  22
  21          #define offMin2   0
  22          
  23          // set clock to 8:00 when press set time button once
  24          #define setHour   8
  25          #define setMin    0
  26          
  27          // rename i/o devices
  28          #define LAMP PIN_B0
  29          #define LED  PIN_B1
  30          #define KEY  PIN_B2
  31          
  32          // variables declaration
  33          char sec,min,hour,flag1,rate,temp;
  34          
  35          // Bit assignment of flag1
  36          // mask byte   effect
  37          // 0x20        installation test on/off(0)
  38          // 0x40        compare time enable bit(1)
  39          // 0x10        blink disable (1)
  40          // 0x01        button pressed (1)
  41          
  42          time() // update clock every 1 second
  43          {
  44   1         sec++;
  45   1         if ( sec >= 60)
  46   1            {
  47   2             sec = 0;
  48   2             min++;
  49   2                if ( min >= 60)
  50   2                   {
  51   3                   min = 0;
  52   3                   hour++;
  53   3                     if ( hour >= 24)
C51 COMPILER V6.12  508                                                                    03/05/2009 17:11:16 PAGE 2   

  54   3                        hour = 0;
  55   3                   }
  56   2            }
  57   1       }
  58          
  59          testOnOff()
  60          {
  61   1          if ((flag1 & 0x20) == 0)
  62   1          {
  63   2              if(hour == onHour1 && min == onMin1)
  64   2                  {
  65   3                  flag1 |= 0x10; // disable blink
  66   3                  output_high(LAMP); // on triac
*** ERROR C202 IN LINE 66 OF .\508.C: 'PIN_B0': undefined identifier
  67   3                  }
  68   2              if(hour == offHour1 && min == offMin1)
  69   2                  {
  70   3                   output_low(LAMP); // off triac
*** ERROR C202 IN LINE 70 OF .\508.C: 'PIN_B0': undefined identifier
  71   3                   flag1 |= 0x20; // disable further test on off
  72   3                   flag1 &= ~0x10; // reenable blink
  73   3                  }
  74   2          }
  75   1      }
  76          
  77          compareTimeOn_Off()
  78          {
  79   1          if((flag1 & 0x40) != 0) // allow entering only after 8:00 has been set
  80   1          {
  81   2             testOnOff();
  82   2          if(hour == onHour2 && min == onMin2)
  83   2              {
  84   3              flag1 |= 0x10; // disable further blink
  85   3              output_high(LAMP); // turn lamp on
*** ERROR C202 IN LINE 85 OF .\508.C: 'PIN_B0': undefined identifier
  86   3              }
  87   2          if(hour == offHour2 && min == offMin2)
  88   2              {
  89   3              output_low(LAMP); // turn lamp off
*** ERROR C202 IN LINE 89 OF .\508.C: 'PIN_B0': undefined identifier
  90   3              flag1 &= ~0x10; // reenable blink
  91   3              }
  92   2          }
  93   1      }
  94          
  95          setTime()
  96          {
  97   1         if ((flag1 & 0x01) != 0) //input(KEY)==0)
  98   1            {
  99   2            hour = setHour;
 100   2            min = setMin;
 101   2            sec = 0;
 102   2            flag1 |= 0x40;  // enable compare time
 103   2            flag1 &= ~0x20;  // reenable test on off
 104   2            flag1 &= ~0x01; // clear key press bit
 105   2            rate = 5;
 106   2            }
 107   1      }
 108          
 109          blink() // turn LED on 100 ms
 110           {
 111   1         output_low(LED);
C51 COMPILER V6.12  508                                                                    03/05/2009 17:11:16 PAGE 3   

*** ERROR C202 IN LINE 111 OF .\508.C: 'PIN_B1': undefined identifier
 112   1         delay_ms(100);
*** WARNING C206 IN LINE 112 OF .\508.C: 'delay_ms': missing function-prototype
*** ERROR C267 IN LINE 112 OF .\508.C: 'delay_ms': requires ANSI-style prototype
 113   1         output_high(LED);
*** ERROR C202 IN LINE 113 OF .\508.C: 'PIN_B1': undefined identifier
 114   1       }
 115          
 116          
 117          fireLED()
 118          {
 119   1         if ((flag1 & 0x10) == 0) // blink only triac is not turned on
 120   1         {
 121   2         temp++;
 122   2      	if ( temp == rate)
 123   2            {
 124   3            blink();
 125   3            temp = 0;
 126   3            }
 127   2         }
 128   1      }
 129          
 130          chkKEY()
 131          {
 132   1         if(input(KEY)==0)
*** ERROR C202 IN LINE 132 OF .\508.C: 'PIN_B2': undefined identifier
 133   1            {flag1 |= 0x01; // set bit 0 telling key been pressed
 134   2             flag1 |= 0x10; // disable firing LED
 135   2             output_high(LAMP); // turn on lamp when press button
*** ERROR C202 IN LINE 135 OF .\508.C: 'PIN_B0': undefined identifier
 136   2            }
 137   1      }
 138          
 139          
 140          main()
 141          {
 142   1      
 143   1         setup_counters(RTCC_INTERNAL,RTCC_DIV_32); // [32768/4]/32 = 256Hz
*** ERROR C202 IN LINE 143 OF .\508.C: 'RTCC_INTERNAL': undefined identifier
 144   1      
 145   1         output_low(LAMP);
*** ERROR C202 IN LINE 145 OF .\508.C: 'PIN_B0': undefined identifier
 146   1         output_high(LED);
*** ERROR C202 IN LINE 146 OF .\508.C: 'PIN_B1': undefined identifier
 147   1         flag1 = 0;
 148   1         rate = 1;
 149   1         temp = 0;
 150   1         tmr0 = 0;
*** ERROR C202 IN LINE 150 OF .\508.C: 'tmr0': undefined identifier
 151   1         hour = 18;
 152   1         min = 0;
 153   1         sec = 0;
 154   1      
 155   1         while(1)
 156   1         {
 157   2            while( tmr0 != 0) // while waiting 1sec elapsed check button also
*** ERROR C202 IN LINE 157 OF .\508.C: 'tmr0': undefined identifier
 158   2              chkKEY();
 159   2         // the following tasks executed every 1 second
 160   2              time();
 161   2              compareTimeOn_Off();
 162   2              fireLED();
C51 COMPILER V6.12  508                                                                    03/05/2009 17:11:16 PAGE 4   

 163   2              setTime();
 164   2      
 165   2         }
 166   1      }

C51 COMPILATION COMPLETE.  1 WARNING(S),  16 ERROR(S)

⌨️ 快捷键说明

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