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

📄 second.lst

📁 ASC 信号机控制程序,国内最先进的信号机控制程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 174   1             return (mmax_timed);
 175   1      }
 176          /*-----------------------------------*/
C51 COMPILER V6.02  SECOND                                                                 09/28/2006 21:46:49 PAGE 4   

 177          void max_clear_time()    using 1
 178          {
 179   1         uchar i;
 180   1         uint now_phase_temp,now_phase_tempn;
 181   1         uint toto;
 182   1          uint phasek;
 183   1           max_yellow=0;
 184   1           max_red_clear=0;
 185   1           max_green_flash=0;
 186   1           if(step_counter==0x01){
 187   2                    max_yellow=0;
 188   2                                 }
 189   1           for(i=0; i<16; i++)
 190   1            {
 191   2      
 192   2              toto = 0x0001;
 193   2              toto = toto<<i;
 194   2              phasek = 18*i;
 195   2      
 196   2                 now_phase_temp = (toto&inuse_phase[step_counter]);
 197   2                 now_phase_tempn = toto&inuse_phasen[step_counter];
 198   2          if((now_phase_temp!=0)/*&& (now_phase_tempn==0)*/)// 本阶段包含,下一阶段不包含
 199   2              {
 200   3                   if(max_yellow<XBYTE[baseaddr_now_phasesch+phasek+15])
 201   3                   max_yellow=XBYTE[baseaddr_now_phasesch+phasek+15];
 202   3                   if(max_red_clear<XBYTE[baseaddr_now_phasesch+phasek+16])
 203   3                   max_red_clear=XBYTE[baseaddr_now_phasesch+phasek+16];
 204   3                   if(max_green_flash<XBYTE[baseaddr_now_phasesch+phasek+17])
 205   3                   max_green_flash=XBYTE[baseaddr_now_phasesch+phasek+17];
 206   3      
 207   3               }
 208   2            }
 209   1            clear_time=max_yellow+max_red_clear;//红灯和黄灯的清空时间
 210   1      }
 211          /************计算个阶段的各相位的清空时间***在每阶段的开始时执行一次****************/
 212          /************计算个阶段的各相位的清空时间***在每阶段的开始时执行一次****************/
 213           void cal_clear_time()
 214          {
 215   1         uchar i;
 216   1         uint phasek;
 217   1        for(i=0; i<16; i++)
 218   1            {
 219   2                phasek = 18*i;
 220   2                red_clear[i] = XBYTE[baseaddr_now_phasesch+phasek+16];   //红灯清空时间
 221   2                //red_yellow_clear[i] = red_clear[i]+XBYTE[baseaddr_now_phasesch+phasek+15]; //黄灯清空时间
 222   2                red_yellow_clear[i] = red_clear[i]+ max_yellow;
 223   2                red_yellow_green_clear[i] = red_yellow_clear[i]+XBYTE[baseaddr_now_phasesch+phasek+17]; //行人清
             -空时间
 224   2            }
 225   1      }
 226          /*****************************************************************************************************/
 227          // 查找灯色
 228          /*****************************************************************************************************/
 229          void  search_color()  using 1
 230          {
 231   1          uchar  data i,j,difer,diff;
 232   1          uint data toto,toto1;
 233   1          uchar data asc_flag=0;
 234   1       //   uint phasek;
 235   1         for(i=0;i<32;i++){
 236   2              if(sensor_step[step_counter]!=0){
 237   3                                         asc_flag=1;
C51 COMPILER V6.02  SECOND                                                                 09/28/2006 21:46:49 PAGE 5   

 238   3                                         break;
 239   3                                               }
 240   2                    }
 241   1      
 242   1          if((sensor_virgin_flag)&&(/*sensor_step[step_counter]*/asc_flag==1))
 243   1              {
 244   2                 sensor_virgin_flag = 0;
 245   2                 step_time = search_step_time();             //阶段时间在开始时只加载一次=最小绿灯+红灯+黄灯
 246   2              }
 247   1          run_state=0x01;
 248   1      
 249   1          use_lamp=use_lamp_sch;
 250   1      /*    if(use_lamp_sch!=0x3fff){
 251   1                use_lamp_sch=0;
 252   1                                   } */
 253   1          for(i=0; i<16; i++)
 254   1          {
 255   2              toto =(0x0001<<i);
 256   2              if((use_lamp&toto)==toto)lamp_state[i]=4;      /*使用的灯组置成红色先*/
 257   2                                  else lamp_state[i]=7;      /*不用的灯组灭掉*/
 258   2      
 259   2          }
 260   1            max_clear_time();
 261   1            cal_clear_time();//计算个阶段的清空时间
 262   1           // max_clear_time();
 263   1            ///////////////////////////////////////////////////////////////////////////////
 264   1      //遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控
 265   1      ////////////////////////////////////////////////////////////////////////////////
 266   1      
 267   1              if(re_control==1) {    //遥控
 268   2                   run_state=0x03;
 269   2                   if(act_flag==1){ //遥控状态发生时,时间转移到当前执行阶段绿灯最后一秒 遥控发生秒
 270   3                               act_flag=0;
 271   3                               if(clear_flag==0){ //绿灯阶段当前阶段倒计时置为绿灯最后一秒,
 272   4                                       now_uncount =max_green_flash+max_red_clear+max_yellow+1;
 273   4                                                 } //处于本阶段清空时刻,不处理,顺其自然
 274   3      
 275   3      
 276   3                                   }else{   //非遥控发生秒执行语句
 277   3                                   if(re_keep_flag==1){//
 278   4                                            now_uncount=max_green_flash+max_red_clear+max_yellow+1;
 279   4                                                   }else {//遥控的是当前运行阶段或处于过时间不需要减少
 280   4                                            if(step_counter!=reph_number-1){
 281   5                                                                            now_uncount--;
 282   5                                                                            }else{
 283   5                                                                            if(re_exe_flag==1){
 284   6                                                                                  now_uncount =max_green_flash+m
             -ax_red_clear+max_yellow+1;
 285   6                                                                                  re_exe_flag=0;
 286   6                                                                                                }
 287   5                                                                                  }
 288   4                                                 }
 289   3                                       }
 290   2                              }else{//无强制和遥控的状态下
 291   2      
 292   2                                  //now_uncount=XBYTE[baseaddr_now_schemesch+8+step_counter]-now_step_key;
 293   2                                  if((re_control==0)&&last_re_control==1){
 294   3                                                now_uncount=max_green_flash+max_red_clear+max_yellow+1;
 295   3                                                now_step_key=0;
 296   3                                                                          }
 297   2      
 298   2                                   }
C51 COMPILER V6.02  SECOND                                                                 09/28/2006 21:46:49 PAGE 6   

 299   1      
 300   1            //  last_re_control=re_control;
 301   1      //遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控遥控
 302   1       ///////////////////////////////////////////////////////////////////////////////////////
 303   1      //强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制强制
 304   1      ////////////////////////////////////////////////////////////////////////////////////////
 305   1            if(force_flag==1){    //强制阶段号发生变化
 306   2                      run_state=0x02;
 307   2               //     if(force_number!=last_forcenumber){
 308   2                           if(act_force==1){ //进入强制控制的第一秒
 309   3                                    act_force=0;
 310   3                                    if(clear_force==0){//绿灯阶段
 311   4                                             now_uncount =max_green_flash+max_red_clear+max_yellow+1;
 312   4                                                       }
 313   3                                            }else{
 314   3                                if(re_keep_force==1){//原阶段绿闪,黄灯清空时间后第一秒
 315   4                                         now_uncount=max_green_flash+max_red_clear+max_yellow+1;
 316   4                                       }else{
 317   4                                          if(step_counter!=force_number-1){
 318   5                                              now_uncount--;     //新的强制输入后,原阶段剩余时间继续减少
 319   5                                         }else{
 320   5                                            if(force_exe_flag==1){
 321   6                                                now_uncount =max_green_flash+max_red_clear+max_yellow+1;
 322   6                                                 force_exe_flag=0;
 323   6                                                                }
 324   5                                                             }
 325   4                                                        }
 326   3                                                  }
 327   2                                                }else{ //无强制状态下
 328   2                                      if(re_control!=1){  //正常自动运行状态下非感应控制倒计时计算和赶感应控制倒
             -计时计算
 329   3                                                        //非感应控制
 330   3                                      if(/*sensor_step[step_counter]*/asc_flag==0)now_uncount=XBYTE[baseaddr_now
             -_schemesch+8+step_counter]-now_step_key;
 331   3      
 332   3                                                        //感应控制
 333   3                                      if(/*sensor_step[step_counter]*/asc_flag==1){
 334   4                                                     if(per_count>2){
 335   5                                                           if(go>1){
 336   6                                                        //       now_uncount=step_time-now_step_key;
 337   6                                                               now_uncount=sch_step[step_counter]-now_step_key; 
             -//降级使用
 338   6                                                               auto_down=1;
 339   6                                                                        }else {
 340   6                                                             now_uncount=step_time-now_step_key;
 341   6                                                                        }
 342   5                                                          }
 343   4                                                        else {
 344   5                                                             now_uncount=step_time-now_step_key;
 345   5                                                                        }
 346   4                                                                      }
 347   3                                      if((alt_change==0x01)&&(machine_flag==0x01)){ //新阶段第一秒并且信号机做主
             -机使用
 348   4                                                                alt_change=0;
 349   4                                                                deal_zone(); //发送点:阶段开始的第一秒发送个从

⌨️ 快捷键说明

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