📄 second.lst
字号:
406 4 {
407 5 clear_flag=1;
408 5 clear_force=1;
409 5 if(now_phase_tempn==0)
410 5 now_phase_status = now_phase_status&(~now_phase_temp);
411 5 now_step_uncount = now_uncount; //当前阶段的倒计时
412 5
413 5 for(j=0; j<16; j++)
414 5 {
415 6 toto1 = 0x0001;
416 6 toto1 = toto1<<j;
417 6 inuse_lamp_temp = toto1&now_lamp;
418 6 if(inuse_lamp_temp!=0)
419 6 {
C51 COMPILER V6.02 SECOND 08/02/2006 15:11:10 PAGE 8
420 7 lamp_state[j]=4; /*当前阶段用的灯组置成绿闪*/
421 7 if(now_phase_tempn!=0)
422 7 lamp_state[j]=1; /*下一阶段用的灯组仍置成绿色*/
423 7 }
424 6 }
425 5 }
426 4 }
427 3 }
428 2 }
429 1 /////////////////////////////////////////////////////////////////////////////////////////////
430 1 //感应阶段,感应阶段 感应阶段,感应阶段感应阶段,感应阶段感应阶段,感应阶段感应阶段,感应阶段
431 1 /////////////////////////////////////////////////////////////////////////////////////////////
432 1 else if(sensor_step[step_counter]==1) //阶段为感应配时
433 1 {
434 2
435 2 if(sensor_virgin_flag)
436 2 {
437 3 sensor_virgin_flag = 0;
438 3 step_time = search_step_time(); //阶段时间在开始时只加载一次=最小绿灯+红灯+黄灯
439 3 }
440 2
441 2
442 2 for(i=0; i<16; i++) //此循环用于查找当前阶段用到的相位
443 2 {
444 3
445 3 toto = 0x0001;
446 3 toto = toto<<i;
447 3 now_phase_temp = toto&inuse_phase[step_counter]; //当前阶段是否包含该相位
448 3 now_phase_tempn = toto&inuse_phasen[step_counter];
449 3 if(now_phase_temp!=0) //
450 3 {
451 4 now_lamp_temp = XBYTE[baseaddr_now_phasesch+18*i];
452 4 now_lamp_temp = now_lamp_temp<<8;
453 4 now_lamp = now_lamp_temp|XBYTE[baseaddr_now_phasesch+18*i+1];
454 4
455 4
456 4 if(now_uncount>red_yellow_green_clear[i]) //当前倒计时处于绿灯时间范围内
457 4 {
458 5 clear_flag=0; //不处于清空时间
459 5 clear_force=0;
460 5 //绿灯倒计时=阶段倒计时-全红时间-黄灯时间
461 5 now_phase_status = now_phase_status|now_phase_temp;
462 5 //行人相位倒计时采用当前以红清空时间为基准
463 5 if((XBYTE[baseaddr_now_phasesch+18*i+2]&0x04)!=0x04){
464 6 now_step_uncount = now_uncount-red_yel
-low_clear[i];
465 6 }
466 5 //当前阶段倒计时
467 5 if(now_step_key<(step_time-sensor_distance-max_red_clear-max_yellow))sensor_car_flag = 0;
468 5 //当前阶段倒计时处于绿时可延长范围
469 5 if(now_step_key<(step_time-max_green_flash-max_red_clear-max_yellow)&&now_step_key>=(step_t
-ime-max_green_flash-max_red_clear-max_yellow-sensor_distance))
470 5 {
471 6 sensor_car_flag=1;
472 6 //无遥控和强制状况下
473 6 if((carnumber!=lastcarnumber))//&&(re_control==0)&&(force_flag!=1))
474 6 {
475 7 lastcarnumber = 0;
476 7 carnumber=0;
477 7 add_greentime =now_step_key+sensor_distance;
478 7 if(add_greentime>=max_greentime)
479 7 {
C51 COMPILER V6.02 SECOND 08/02/2006 15:11:10 PAGE 9
480 8 ensensor_flag = 0;
481 8 sensor_car_flag = 0;
482 8 add_greentime = max_greentime;
483 8 }
484 7 step_time = add_greentime+XBYTE[baseaddr_now_phasesch+18*i+15]+XBYTE[baseaddr
-_now_phasesch+18*i+16]+XBYTE[baseaddr_now_phasesch+18*i+17];
485 7 sensor_counter = 1;
486 7 now_step_key=now_step_key-sensor_distance;
487 7 // lastcarnumber = 0;
488 7 // carnumber=0;
489 7 }
490 6 }
491 5 for(j=0; j<16; j++) //此循环用于查找当前相位用到的灯组
492 5 {
493 6 toto1 = 0x0001;
494 6 toto1 = toto1<<j;
495 6 inuse_lamp_temp = toto1&now_lamp;
496 6 if(inuse_lamp_temp!=0)
497 6 {
498 7 lamp_state[j]=1; /*当前阶段用的灯组置成绿色*/
499 7 }
500 6 }
501 5 } //当前倒计时处于绿闪时间范围内
502 4 else if(now_uncount>=red_yellow_clear[i]&&now_uncount<=red_yellow_green_clear[i])
503 4 { clear_flag=1;
504 5 clear_force=1;
505 5 now_step_uncount = now_uncount-red_yellow_clear[i]; //当前阶段的倒计时
506 5
507 5 for(j=0; j<16; j++) //此循环用于查找当前相位用到的灯组
508 5 {
509 6 toto1 = 0x0001;
510 6 toto1 = toto1<<j;
511 6 inuse_lamp_temp = toto1&now_lamp;
512 6 if(inuse_lamp_temp!=0)
513 6 {
514 7 if(now_phase_tempn==0)
515 7 {
516 8 ensensor_flag = 0;
517 8 sensor_car_flag = 0;
518 8 step_time = now_step_key+now_uncount;
519 8 lamp_state[j]=2; /*当前阶段用的灯组置成绿闪*/
520 8
521 8 }
522 7 else
523 7 {
524 8 lamp_state[j]=1; /*下一阶段用的灯组仍置成绿色*/
525 8 }
526 7 }
527 6 }
528 5 }
529 4 // else if(now_uncount>=red_clear[i]) //当前倒计时处于黄灯时间范围内
530 4 else if(now_uncount<red_yellow_clear[i]&&now_uncount>=red_clear[i]) //当前倒计时处于黄灯时间范围内
531 4 { clear_flag=1;
532 5 clear_force=1;
533 5 if(now_phase_tempn==0)
534 5 now_phase_status = now_phase_status&(~now_phase_temp);
535 5 now_step_uncount = now_uncount-red_clear[i]; //当前阶段的倒计时
536 5
537 5 for(j=0; j<16; j++) //此循环用于查找当前相位用到的灯组
538 5 {
539 6 toto1 = 0x0001;
540 6 toto1 = toto1<<j;
C51 COMPILER V6.02 SECOND 08/02/2006 15:11:10 PAGE 10
541 6 inuse_lamp_temp = toto1&now_lamp;
542 6 if(inuse_lamp_temp!=0)
543 6 {
544 7 // if(now_uncount>red_clear[i])
545 7 {
546 8 lamp_state[j]=3; /*当前阶段用的灯组置成黄色*/
547 8 if((XBYTE[baseaddr_now_phasesch+18*i+2]&0x04)==0x04)
548 8 lamp_state[j]=4; /*灯组是行人灯组,在黄灯期间置红色*/
549 8 }
550 7 if(now_phase_tempn!=0)
551 7 lamp_state[j]=1; /*下一阶段用的灯组仍置成绿色*/
552 7 }
553 6 }
554 5 }
555 4 else if(now_uncount<=red_clear[i]) //当前倒计时处于全红时间范围内
556 4 { clear_flag=1;
557 5 clear_force=1;
558 5 if(now_phase_tempn==0)
559 5 now_phase_status = now_phase_status&(~now_phase_temp);
560 5 now_step_uncount = now_uncount; //当前阶段的倒计时
561 5
562 5 for(j=0; j<16; j++)
563 5 {
564 6 toto1 = 0x0001;
565 6 toto1 = toto1<<j;
566 6 inuse_lamp_temp = toto1&now_lamp;
567 6 if(inuse_lamp_temp!=0)
568 6 {
569 7 lamp_state[j]=4; /*当前阶段用的灯组置成绿闪*/
570 7 if(now_phase_tempn!=0)
571 7 lamp_state[j]=1; /*下一阶段用的灯组仍置成绿色*/
572 7 }
573 6 }
574 5 }
575 4 }
576 3 }
577 2 }
578 1
579 1 count_step++;
580 1 now_step_key++; //如果没有强制标志
581 1 if(now_uncount==1) //一个阶段时间走完
582 1 {
583 2 exit_remote=0;
584 2 if(re_control==1){//遥控和手动状况
585 3 re_keep_flag=1; //状态维持标志
586 3
587 3 clear_state=0;
588 3 re_exe_flag=0; //进入新阶段后认为遥控动作结束,进入静态显示状态
589 3 force_exe_flag=0;
590 3 step_counter=reph_number-1; //新的阶段号
591 3 }
592 2 if(force_flag==1){
593 3 forceacting=0; //一次强制转换结束
594 3 re_keep_force=1;
595 3 re_exe_flag=0;
596 3 force_exe_flag=0;
597 3 step_counter=force_number-1;
598 3 }else{//非遥控强制阶段状况下
599 3 if(re_control!=1)step_counter++;
600 3 }
601 2 //cal_clear_time();//计算个阶段的清空时间
602 2 //max_clear_time();
C51 COMPILER V6.02 SECOND 08/02/2006 15:11:10 PAGE 11
603 2 now_step_key = 0;
604 2 sensor_virgin_flag = 1;
605 2 /////////////////////////////////////////////////////////
606 2 period_sch[7+step_counter]=count_step; //当前阶段时间
607 2 count_step=0;
608 2 ///////////////////////////////////////////////////////
609 2 if(step_counter>=step_num){ //周期结束
610 3 period_update = 1;
611 3 EA=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -