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

📄 second.c.bak

📁 最先进的信号机程序,经过很多重要场合测试通过
💻 BAK
📖 第 1 页 / 共 4 页
字号:
              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;
                             }
                       }else{
              //强制阶段不是当前放行的阶段,当前阶段被置成绿闪
            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]=4;      //黄灯
                             }
                   }
              /////////////////此处插入强制阶段置绿程序/////////////////
            lai_nouse=(now_step_schid-1)*98; //当前阶段表号---阶段表号
            lai_nouse=0x5242+lai_nouse;      //计算阶段表地址偏移量
            toto=lai_nouse;
            toto=toto+(co-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]=1;      //绿灯                            }
                  }
              }
        if(hand_counter==7)step_counter=co-1;
        if(hand_counter<5){ //前三秒判断
        if(co==(step_counter+1)){//如果当前强制的阶段是当前正放行的相位,不管当前是什么灯色一律置成绿色
            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]=1;
                             }
                         }else{
              //强制阶段不是当前放行的阶段,当前阶段被置成绿闪
            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]=2;
                             }
                      }
                }
  ///////////////////////////////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////////////
  /*新插入程序开始*/
        if((hand_counter>=5)&&(hand_counter<7)){ //前三秒判断
        if(co==(step_counter+1)){//如果当前强制的阶段是当前正放行的相位,不管当前是什么灯色一律置成绿色
            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]; //相位对应的通道高位字节

⌨️ 快捷键说明

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