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

📄 second.c.bak

📁 最先进的信号机程序,经过很多重要场合测试通过
💻 BAK
📖 第 1 页 / 共 4 页
字号:
                   hand_phase=hand_phase<<8;
                   hand_phase=hand_phase+XBYTE[hand_lamp+1]; //相位对应通道的全部内容
                   control_chunel=control_chunel|hand_phase;
                                              }
                                }
           for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000;
                   //当前阶段(被强制的阶段)被置成绿色
              if((control_chunel&shift)==shift)lamp_state[i]=1;
                             }
              if(hand_counter==6)step_counter=co-1;///////////////////////////////////////
                       }else{
              //强制阶段不是当前放行的阶段,当前阶段被置成yellow
            lai_nouse=(now_step_schid-1)*98; //阶段表号
            lai_nouse=0x5242+lai_nouse;      //计算阶段表地址偏移量
            toto=lai_nouse;
            toto=toto+(step_counter)*3+2;    //当前阶段放行的相位
            lai_nouse=toto;
            toto1=XBYTE[toto];
            temp=toto1;
            toto1=toto1<<8;
            toto1=toto1+XBYTE[toto+1];     //当前阶段对应放行的相位
            lai=toto1;
            toto=0x5246+(now_step_schid-1)*98;
            tmd=toto;
            temp=XBYTE[toto];
            if(temp==0)toto=0x5001;       //通过阶段表中空白属
                  else toto=0x5122;       //性确认阶段表所依赖的相位表
            guli=toto;
            control_chunel=0;
            for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000;

              if((lai&shift)==shift){
                   hand_lamp=guli+i*18;    //相位对应的通道地址
                   hand_phase=XBYTE[hand_lamp]; //相位对应的通道高位字节
                   hand_phase=hand_phase<<8;
                   hand_phase=hand_phase+XBYTE[hand_lamp+1]; //相位对应通道的全部内容
                   control_chunel=control_chunel|hand_phase;
                                              }
                                }
           for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000; //当前阶段不是被强制的阶段,进入黄灯阶段
              if((control_chunel&shift)==shift){
                                                lamp_state[i]=3;
                                                }
                             }
              if(hand_counter==6)step_counter=co-1;///////////////////////////////////////
                  }
                }

  ///////////////////////////////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////////////
  /*新插入程序结束*/


    sss=co;
    lastforce=nowforce ; //
}

void escape()
{
  unsigned int  xdata toto,toto1;
  unsigned char xdata i;

  if(esc_counter<4){ //强制的相位在强制结束时置绿闪
            lai_nouse=(now_step_schid-1)*98; //阶段表号
            lai_nouse=0x5242+lai_nouse;      //计算阶段表地址偏移量
            toto=lai_nouse;
            toto=toto+(sss-1)*3+2;    //当前阶段放行的相位
            lai_nouse=toto;
            toto1=XBYTE[toto];
            temp=toto1;
            toto1=toto1<<8;
            toto1=toto1+XBYTE[toto+1];     //当前阶段对应放行的相位
            lai=toto1;
            toto=0x5246+(now_step_schid-1)*98;
            tmd=toto;
            temp=XBYTE[toto];
            if(temp==0)toto=0x5001;       //通过阶段表中空白属
                  else toto=0x5122;       //性确认阶段表所依赖的相位表
            guli=toto;
            control_chunel=0;
            for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000;

              if((lai&shift)==shift){
                   hand_lamp=guli+i*18;    //相位对应的通道地址
                   hand_phase=XBYTE[hand_lamp]; //相位对应的通道高位字节
                   hand_phase=hand_phase<<8;
                   hand_phase=hand_phase+XBYTE[hand_lamp+1]; //相位对应通道的全部内容
                   control_chunel=control_chunel|hand_phase;
                                              }
                                }
           for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000; //当前阶段不是被强制的阶段,进入黄灯阶段
              if((control_chunel&shift)==shift)lamp_state[i]=2;
                             }
                  }

      if(esc_counter>=4){ //强制的相位在强制结束时绿闪后黄灯
            lai_nouse=(now_step_schid-1)*98; //阶段表号
            lai_nouse=0x5242+lai_nouse;      //计算阶段表地址偏移量
            toto=lai_nouse;
            toto=toto+(sss-1)*3+2;    //当前阶段放行的相位
            lai_nouse=toto;
            toto1=XBYTE[toto];
            temp=toto1;
            toto1=toto1<<8;
            toto1=toto1+XBYTE[toto+1];     //当前阶段对应放行的相位
            lai=toto1;
            toto=0x5246+(now_step_schid-1)*98;
            tmd=toto;
            temp=XBYTE[toto];
            if(temp==0)toto=0x5001;       //通过阶段表中空白属
                  else toto=0x5122;       //性确认阶段表所依赖的相位表
            guli=toto;
            control_chunel=0;
            for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000;

              if((lai&shift)==shift){
                   hand_lamp=guli+i*18;    //相位对应的通道地址
                   hand_phase=XBYTE[hand_lamp]; //相位对应的通道高位字节
                   hand_phase=hand_phase<<8;
                   hand_phase=hand_phase+XBYTE[hand_lamp+1]; //相位对应通道的全部内容
                   control_chunel=control_chunel|hand_phase;
                                              }
                                }
           for(i=0;i<16;i++){
              if(i==0)shift=0x0001;
              if(i==1)shift=0x0002;
              if(i==2)shift=0x0004;
              if(i==3)shift=0x0008;
              if(i==4)shift=0x0010;
              if(i==5)shift=0x0020;
              if(i==6)shift=0x0040;
              if(i==7)shift=0x0080;
              if(i==8)shift=0x0100;
              if(i==9)shift=0x0200;
              if(i==10)shift=0x0400;
              if(i==11)shift=0x0800;
              if(i==12)shift=0x1000;
              if(i==13)shift=0x2000;
              if(i==14)shift=0x4000;
              if(i==15)shift=0x8000; //当前阶段不是被强制的阶段,进入黄灯阶段
              if((control_chunel&shift)==shift){
                                                lamp_state[i]=3;
                                                }
                             }
                  }
}


/*****************************************************************************************************/
//  半秒中断
/*****************************************************************************************************/
void secondint() interrupt 2 using 1
{
    uchar  i;
    i = D12887C;
    FarContrlLed = !FarContrlLed;
    WatchDog = !WatchDog;
    ssecond = !ssecond;
    if(ssecond)
    {
         force_flag=XBYTE[0X6d28];         /*读取强制标志*/
         tran_count++;                     /*发送测试包的计数器*/
         start_counter++;
         if(start_counter>20)  start_counter=20;
         if(start_counter<=3)             /*开机黄闪*/
         {
            for(i=0;i<16;i++)
            {
               lamp_state[i]=5;
            }
         }
         else if((start_counter>3) && (start_counter<6))    /*开机全红*/
         {
            for(i=0;i<16;i++)
            {
               lamp_state[i]=4;
            }
         }
         else if(start_counter==6)
            period_update=1;  /*开机黄闪全红后,更改周期更迭标志*/
         else if(start_counter>=7)
         {
            if(re_control!=1)
            search_color();       // key++;
             make0x83();

            temp=XBYTE[0X6d28];      //手动强制标志            ///////////////////////////////////////////////
            co=XBYTE[0x6d29];        //强制的阶段号
            hand_lamp=0;
            if(temp==1){
                 handremote();/*强制和遥控*/
                     }else{
                    hand_counter=0;
                           }
            if(esc_flag==1){
                      escape();
                           }
            last_forceflag=force_flag;
         }
    }

  //强制解除操作
 //hand_control();       //手动控制
 if((now_schemeid==0x21)&&(start_counter>=3)){
     for(i=0;i<16;i++)
            {
               lamp_state[i]=5;
            }
                        }
                        
 remote_ph();                       
 
 re_ye_allred();
 lamp_out();
}

⌨️ 快捷键说明

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