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

📄 almset1.lst

📁 keil无2k限制
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 1   


C51 COMPILER V7.00, COMPILATION OF MODULE ALMSET1
OBJECT MODULE PLACED IN .\Almset1.obj
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE ..\ALARM\Almset1.c BROWSE DEBUG OBJECTEXTEND PRINT(.\Almset1.lst) OBJECT(.\
                    -Almset1.obj)

stmt level    source

   1                   /* ALMSET1.C-V1 */
   2                   /* 2002/07/13 */
   3          
   4          
   5          #include<reg52.h>
   6          #include<math.h>
   7          #include<intrins.h>
   8          #include"almset1.h"
   9          #include"bitdef.h"
  10          
  11          #define HAVE_SETPHONE
  12          
  13          void delay_milliseconds(uint i);
  14          //static bit mbphone_ring();
  15          //static void wait_phone_answer();
  16          static bit urgent_alarm_occur();
  17          static bit sensor_alarm_occur();
  18          static bit door_alarm_occur();
  19          static bit phone_power_off();
  20          static void report_alarm(uchar phone_id,uchar m1,uchar m2,uchar m3);
  21          static void get_number(uchar address);
  22          #define check_number         get_number
  23          static void get_rc_inst();
  24          static void store_rc_inst();
  25          static void deal_seconds();
  26          static bit confirm_ring_occur();
  27          static bit ac_power_state();
  28          #ifdef HAVE_SETPHONE
  29          static bit phone_line_cut_off();
  30          #endif
  31          static uchar receive_dtmf_byte();
  32          static void char_to_bcd(uchar m);
  33          static void get_dtmf_instruction();
  34          
  35          bit flag_by_mb_or_set;
  36          bit flag_permit_int_t0;
  37          static uchar count_red_led_flash;
  38          static uchar count_green_led_flash;
  39          static uint door_count;
  40          static bit flag_serial_number_valid;
  41          static bit flag_phone_1_number_valid;
  42          static bit flag_phone_2_number_valid;
  43          static bit flag_phone_3_number_valid;
  44          static bit flag_led;
  45          static bit flag_seconds_count_overflow;
  46          static bit rc_state_prev;
  47          static bit flag_reporting_alarm;
  48          static bit flag_store_rc_inst;
  49          static bit flag_connect_phone;
  50          static bit flag_section_1_set_alarm;
  51          static bit flag_section_2_set_alarm;
  52          static bit flag_section_3_set_alarm;
  53          static bit flag_section_4_set_alarm;
  54          static bit flag_section_5_set_alarm;
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 2   

  55          static bit flag_section_6_set_alarm;
  56          static bit flag_section_7_set_alarm;
  57          static bit flag_section_8_set_alarm;
  58          static bit flag_urgent_alarm_occur;
  59          static bit flag_ac_power_on_reported;
  60          static bit flag_ac_power_off_reported;
  61          static bit flag_led_flash;
  62          static bit flag_sw_state;
  63          static bit flag_mbphone_power_on;
  64          static bit flag_enable_bell;
  65          static bit flag_risk_occur;
  66          static bit flag_enable_report_to_user;
  67          static bit flag_mbphone_ring;
  68          static bit flag_mb_ring_occur;
  69          static bit flag_mbphone_wrong;
  70          static uint rc_count_count;
  71          static uchar rc_lock_count;
  72          static uchar rc_open_count;
  73          static uchar section_number;
  74          static uchar number[16];
  75          static uchar led_flash_count;
  76          static uchar pin_number;
  77          static uint count_milliseconds;
  78          static uchar seconds_wdt;
  79          static uchar seconds_check_number;
  80          static uchar rc_count;
  81          static uchar count_led_pulse;
  82          static uchar stage_led_flash;
  83          static uchar count_bell;
  84          static uchar count_sound;
  85          static uint seconds_check_mb;
  86          static uint seconds_reset_mb;
  87          static uchar seconds_down;
  88          
  89          main()
  90          {uchar m1,m2;
  91   1       uint m3;
  92   1       PSW=0;
  93   1       P0=0xff;
  94   1       P1=0xff;
  95   1       P2=0xff;
  96   1       P3=0xff;
  97   1       PSW=0;
  98   1       TMOD=0x01;       //T0:16 bit timer
  99   1       TL0=TIMER0_CONST & 0x00ff;
 100   1       TH0=TIMER0_CONST >>8;
 101   1       ET0=HIGH;    //permit T0 interrupt
 102   1       TR0=HIGH;    //start T0
 103   1       EA=FALSE;       //not permit interrupt
 104   1       hangup_setphone;
 105   1       flag_by_mb_or_set = BY_MB;
 106   1       init_mbphone_key_bits();
 107   1       count_red_led_flash=25;  //0.25S
 108   1       flag_store_rc_inst = FALSE;
 109   1       flag_connect_phone = FALSE;
 110   1       flag_reporting_alarm = FALSE;
 111   1       flag_by_mb_or_set = BY_SET;
 112   1       flag_urgent_alarm_occur = FALSE;
 113   1       flag_ac_power_on_reported = TRUE;
 114   1       flag_ac_power_off_reported = FALSE;
 115   1       flag_sw_state = bit_sw;
 116   1       led_flash_count = 0;
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 3   

 117   1       count_milliseconds = 1000/TIME_TIMER0;      //1 S
 118   1       section_number = 0;
 119   1       stage_led_flash = 0;
 120   1       count_led_pulse= 0;
 121   1       count_bell = 0;
 122   1       count_sound = 0;
 123   1       flag_section_1_set_alarm = FALSE;
 124   1       flag_section_2_set_alarm = FALSE;
 125   1       flag_section_3_set_alarm = FALSE;
 126   1       flag_section_4_set_alarm = FALSE;
 127   1       flag_section_5_set_alarm = FALSE;
 128   1       flag_section_6_set_alarm = FALSE;
 129   1       flag_section_7_set_alarm = FALSE;
 130   1       flag_section_8_set_alarm = FALSE;
 131   1       flag_enable_report_to_user = FALSE;
 132   1       get_rc_inst();
 133   1       for(m1=0;m1<60;m1++)
 134   1      // while(1)
 135   1       {change_red_led;
 136   2        change_green_led;
 137   2        delay_milliseconds(200);
 138   2       }
 139   1       flag_mbphone_wrong = FALSE;
 140   1       flag_mbphone_ring = FALSE;
 141   1       flag_mb_ring_occur = FALSE;
 142   1       flag_seconds_count_overflow = TRUE;
 143   1       seconds_check_number =1;
 144   1       seconds_check_mb = 1;
 145   1       seconds_reset_mb = SECONDS_RESET_MB;
 146   1       count_red_led_flash = 1000/TIME_TIMER0;
 147   1       count_green_led_flash = 1000/TIME_TIMER0;
 148   1       ret_i();
 149   1       ret_i();
 150   1       ret_i();
 151   1       seconds_wdt = 20;
 152   1       seconds_down = 0;
 153   1      // TL0=TIMER0_CONST & 0x00ff;
 154   1      // TH0=TIMER0_CONST >>8;
 155   1       EA=TRUE;       //permit interrupt
 156   1      // count_milliseconds = 1000/TIME_TIMER0;      //1 S
 157   1       while(1)
 158   1       {seconds_wdt = 15;
 159   2        EA = TRUE;
 160   2        ET0 = TRUE;
 161   2        ES = FALSE;
 162   2        ET1 = FALSE;
 163   2        EX1 = FALSE;
 164   2        EX0 = FALSE;
 165   2        bit_dtmf_oei = LOW;
 166   2        bit_addr_a = HIGH;
 167   2        bit_addr_b = HIGH;
 168   2        bit_addr_c = HIGH;
 169   2        flag_risk_occur = FALSE;
 170   2        if(!(bit_scl&&bit_sda))
 171   2        {delay_milliseconds(2000);
 172   3        }
 173   2        if(flag_seconds_count_overflow)
 174   2        {flag_seconds_count_overflow = FALSE;
 175   3         seconds_check_number --;
 176   3         if(!seconds_check_number)
 177   3         {seconds_check_number = 60;
 178   4          check_number(SERIAL_NUMBER_ADDRESS);
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 4   

 179   4          check_number(PHONE_1_NUMBER_ADDRESS);
 180   4          check_number(PHONE_2_NUMBER_ADDRESS);
 181   4          check_number(PHONE_3_NUMBER_ADDRESS);
 182   4         }
 183   3         seconds_check_mb --;
 184   3         if(!seconds_check_mb)
 185   3         {seconds_check_mb = 300;
 186   4          flag_by_mb_or_set = BY_MB;
 187   4          init_mbphone_key_bits();
 188   4          flag_mbphone_power_on = 0;
 189   4          press_phone_key(KEY_STAR,200,200);
 190   4          press_phone_key(KEY_1,200,200);
 191   4          press_phone_key(KEY_6,200,200);
 192   4          clear_mbphone_screen;
 193   4          if(flag_mbphone_power_on)
 194   4          {flag_mbphone_wrong = FALSE;
 195   5           delay_milliseconds(2000);
 196   5           flag_mbphone_ring = FALSE;
 197   5          }
 198   4          else
 199   4          {seconds_wdt = 20;
 200   5           flag_mbphone_wrong = TRUE;
 201   5           turn_mbphone_on;
 202   5      //     delay_milliseconds(10000);
 203   5           seconds_down = 10;
 204   5           while(seconds_down);
 205   5           clear_mbphone_screen;
 206   5           delay_milliseconds(2000);
 207   5           flag_mbphone_ring = FALSE;
 208   5           seconds_check_mb = 1;
 209   5           continue;
 210   5          }
 211   4         }
 212   3         if(!(flag_section_1_set_alarm||flag_section_2_set_alarm
 213   3            ||flag_section_3_set_alarm||flag_section_4_set_alarm
 214   3            ||flag_section_5_set_alarm||flag_section_6_set_alarm
 215   3            ||flag_section_7_set_alarm||flag_section_8_set_alarm))
 216   3         {seconds_reset_mb --;
 217   4          if(!seconds_reset_mb)
 218   4          {seconds_reset_mb = SECONDS_RESET_MB;
 219   5           flag_by_mb_or_set = BY_MB;
 220   5           press_phone_key(KEY_STAR,200,200);
 221   5           press_phone_key(KEY_2,200,200);
 222   5           press_phone_key(KEY_7,200,200);
 223   5           turn_mbphone_off;
 224   5           delay_milliseconds(2000);
 225   5           flag_mbphone_ring = FALSE;
 226   5           seconds_check_mb = 1;
 227   5           continue;
 228   5          } 
 229   4         }
 230   3        }
 231   2        if(flag_store_rc_inst)
 232   2        {store_rc_inst();
 233   3         flag_store_rc_inst = FALSE;
 234   3        }
 235   2      //  flag_by_mb_or_set = BY_SET;
 236   2        flag_by_mb_or_set = BY_MB;
 237   2        hangup_setphone;         
 238   2        init_setphone_key_bits();
 239   2        m1 = m2 =0;
 240   2      #ifdef HAVE_SETPHONE
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 5   

 241   2        if(phone_line_cut_off())
 242   2        {m2 += 2;
 243   3         flag_by_mb_or_set = BY_MB;
 244   3        }
 245   2        else
 246   2        {flag_by_mb_or_set = BY_SET;
 247   3        }
 248   2      #else
                flag_by_mb_or_set = BY_MB;
              #endif  
 251   2        if(flag_urgent_alarm_occur)
 252   2        {m2 += 4;
 253   3        }
 254   2        if(m2)
 255   2        {flag_risk_occur = TRUE;
 256   3        }
 257   2        else
 258   2        {flag_risk_occur = FALSE;
 259   3        }
 260   2        flag_mb_ring_occur = FALSE;
 261   2        if(flag_mbphone_ring&&confirm_ring_occur())
 262   2        {m2 += 1;
 263   3        }
 264   2        flag_mbphone_ring = FALSE;
 265   2        if(m2)
 266   2        {connect_z1;
 267   3         if(sensor_alarm_occur())
 268   3         {m1 = 1;
 269   4         }
 270   3         connect_z2;
 271   3         if(sensor_alarm_occur())
 272   3         {m1 += 2;
 273   4         }
 274   3         connect_z3;
 275   3         if(sensor_alarm_occur())
 276   3         {m1 += 4;
 277   4         }
 278   3         connect_z4;
 279   3         if(sensor_alarm_occur())
 280   3         {m1 += 8;
 281   4         }
 282   3         connect_z5;
 283   3         if(sensor_alarm_occur())
 284   3         {m1 += 16;
 285   4         }
 286   3         connect_z6;
 287   3         if(sensor_alarm_occur())
 288   3         {m1 += 32;
 289   4         }
 290   3         connect_z7;
 291   3         if( sensor_alarm_occur())
 292   3         {m1 += 64;
 293   4         }
 294   3         connect_z8;
 295   3         if(sensor_alarm_occur())
 296   3         {m1 += 128;
 297   4         }
 298   3        }
 299   2        else
 300   2        {connect_z1;
 301   3         if(flag_section_1_set_alarm && sensor_alarm_occur())
 302   3         {m1 = 1;
C51 COMPILER V7.00  ALMSET1                                                                09/25/2002 15:25:41 PAGE 6   

 303   4         }
 304   3         connect_z2;
 305   3         if(flag_section_2_set_alarm && sensor_alarm_occur())
 306   3         {m1 += 2;
 307   4         }
 308   3         connect_z3;
 309   3         if(flag_section_3_set_alarm && sensor_alarm_occur())
 310   3         {m1 += 4;
 311   4         }
 312   3         connect_z4;
 313   3         if(flag_section_4_set_alarm && sensor_alarm_occur())
 314   3         {m1 += 8;
 315   4         }
 316   3         connect_z5;
 317   3         if(flag_section_5_set_alarm && sensor_alarm_occur())
 318   3         {m1 += 16;
 319   4         }
 320   3         connect_z6;
 321   3         if(flag_section_6_set_alarm && sensor_alarm_occur())
 322   3         {m1 += 32;
 323   4         }
 324   3         connect_z7;
 325   3         if(flag_section_7_set_alarm && sensor_alarm_occur())
 326   3         {m1 += 64;
 327   4         }
 328   3         connect_z8;
 329   3         if(flag_section_8_set_alarm && sensor_alarm_occur())
 330   3         {m1 += 128;
 331   4         }
 332   3         if(m1)
 333   3         {flag_risk_occur = TRUE;
 334   4         }
 335   3        }
 336   2        if(bit_sw)
 337   2        {if((!flag_ac_power_off_reported)&&(ac_power_state()==OFF))
 338   3         {m2 += 8;
 339   4          flag_ac_power_off_reported = TRUE;

⌨️ 快捷键说明

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