📄 alarm.lst
字号:
C51 COMPILER V7.10 ALARM 09/18/2008 14:09:31 PAGE 8
424 4 {
425 5 AlarmModule.uchAlarmStatus[uchChannel - 1] |= b;
426 5 AlarmModule.uiDangerHeartbeatBakL[uchChannel - 1] =0;
427 5 }
428 4 }
429 3 }
430 2 FeedDog();
431 2 }
432 1 }
433
434 //--------------------------------------------------------------------------------------------------
435 //函数名称:void ClearFlagBit(unsigned char uchChannel,unsigned char b)
436 //功 能:清除通道报警位
437 //输入参数:通道号 ,报警位
438 //返 回:无
439 //完成日期:4/16/2007
440 //--------------------------------------------------------------------------------------------------
441 void ClearFlagBit(unsigned char uchChannel,unsigned char b)
442 {
443 1 switch (AlarmModule.uchChannelType[uchChannel - 1])
444 1 {
445 2 case 13: //加速度输入 加速度输出
446 2 case 14: //加速度输入 速度输出
447 2 case 15: //加速度输入 位移输出
448 2 case 16: //速度输入 速度输出
449 2 case 17: //速度输入 位移输出
450 2 case 18: //位移输入 位移输出
451 2 case 21: //涡流+速度 复合式振动输出
452 2 case 22: //HHH
453 2 case 28:
454 2 break;
455 2 default:
456 2 break;
457 2 }
458 1
459 1 if ((b & 0x2) !=0 )
460 1 {
461 2 AlarmModule.uiAlertHeartbeatBakH[uchChannel - 1] = 0;
462 2 }
463 1
464 1 if ((b & 0x4) !=0 )
465 1 {
466 2 AlarmModule.uiAlertHeartbeatBakL[uchChannel - 1] = 0;
467 2 }
468 1
469 1 if ((b & 0x1) !=0 )
470 1 {
471 2 AlarmModule.uiDangerHeartbeatBakH[uchChannel - 1] =0;
472 2 }
473 1
474 1 if ((b & 0x8) !=0 )
475 1 {
476 2 AlarmModule.uiDangerHeartbeatBakL[uchChannel - 1] =0;
477 2 }
478 1
479 1 if ((AlarmModule.uchLatch[uchChannel - 1] == 1) && (AlarmModule.uchResetStatus[uchChannel - 1] == 0))
480 1 {
481 2 return;
482 2 }
483 1 else
484 1 {
485 2 AlarmModule.uchAlarmStatus[uchChannel - 1] &= ~b;
C51 COMPILER V7.10 ALARM 09/18/2008 14:09:31 PAGE 9
486 2 }
487 1 }
488
489 //--------------------------------------------------------------------------------------------------
490 //函数名称:void JudgeAlarmStatus(unsigned char uchChannel)
491 //功 能:检测通道的报警状态并判断报警标志
492 //输入参数:通道号
493 //返 回:无
494 //完成日期:4/16/2007
495 //--------------------------------------------------------------------------------------------------
496 void JudgeAlarmStatus(unsigned char uchChannel) //程序可以省略前面的计算部分,把它放到初始化中
497 {
498 1 int idata iAlertLimitLow,iAlertLimitHigh,iDangerLimitLow,iDangerLimitHigh;
499 1 int idata iAlertLimitLowFall,iAlertLimitHighFall,iDangerLimitLowFall,iDangerLimitHighFall;
500 1
501 1 switch (AlarmModule.uchChannelType[uchChannel - 1])
502 1 {
503 2 case 13: //加速度输入 加速度输出
504 2 case 14: //加速度输入 速度输出
505 2 case 15: //加速度输入 位移输出
506 2 case 16: //速度输入 速度输出
507 2 case 17: //速度输入 位移输出
508 2 case 18: //位移输入 位移输出
509 2 case 21: //涡流+速度 复合式振动输出
510 2 case 22: //LVDT输入 机壳膨胀输出
511 2 case 28: //HHH
512 2 if ((AlarmModule.uchEnable[uchChannel - 1] == 1) && (AlarmModule.uchOKStatus[uchChannel - 1] == 0))
513 2 {
514 3 if (AlarmModule.uchTriple[uchChannel - 1] != 0)
515 3 {
516 4 iAlertLimitLow = AlarmModule.uchTriple[uchChannel - 1]* AlarmModule.iAlertLow[uchChannel - 1];
517 4 iAlertLimitHigh = AlarmModule.uchTriple[uchChannel - 1]* AlarmModule.iAlertHigh[uchChannel - 1];
518 4 iDangerLimitLow = AlarmModule.uchTriple[uchChannel - 1]* AlarmModule.iDangerLow[uchChannel - 1];
519 4 iDangerLimitHigh = AlarmModule.uchTriple[uchChannel - 1]* AlarmModule.iDangerHigh[uchChannel - 1];
520 4 }
521 3 else
522 3 {
523 4 iAlertLimitLow = AlarmModule.iAlertLow[uchChannel - 1];
524 4 iAlertLimitHigh = AlarmModule.iAlertHigh[uchChannel - 1];
525 4 iDangerLimitLow = AlarmModule.iDangerLow[uchChannel - 1];
526 4 iDangerLimitHigh = AlarmModule.iDangerHigh[uchChannel - 1];
527 4 }
528 3
529 3 iAlertLimitLowFall = iAlertLimitLow + AlarmModule.iFallingAlertL[uchChannel - 1];
530 3 iAlertLimitHighFall = iAlertLimitHigh - AlarmModule.iFallingAlertH[uchChannel - 1];
531 3 iDangerLimitLowFall = iDangerLimitLow + AlarmModule.iFallingDangerL[uchChannel - 1];
532 3 iDangerLimitHighFall = iDangerLimitHigh - AlarmModule.iFallingDangerH[uchChannel - 1];
533 3
534 3
535 3 if ( AlarmModule.iCurrentValue[uchChannel - 1] > iDangerLimitHigh )
536 3 {
537 4 SetFlagBit(uchChannel, 0x8);
538 4 }
539 3 else
540 3 {
541 4 if (AlarmModule.iCurrentValue[uchChannel - 1] < iDangerLimitHighFall)
542 4 {
543 5 ClearFlagBit(uchChannel, 0x8);
544 5 }
545 4 }
546 3
547 3 if ( AlarmModule.iCurrentValue[uchChannel - 1] < iDangerLimitLow )
C51 COMPILER V7.10 ALARM 09/18/2008 14:09:31 PAGE 10
548 3 {
549 4 SetFlagBit(uchChannel, 0x1);
550 4 }
551 3 else
552 3 {
553 4 if (AlarmModule.iCurrentValue[uchChannel - 1] > iDangerLimitLowFall)
554 4 {
555 5 ClearFlagBit(uchChannel, 0x1);
556 5 }
557 4 }
558 3
559 3 if (AlarmModule.uchAlertTypeStatus[uchChannel - 1] == 1 ) //Alert
560 3 {
561 4 if ( AlarmModule.iCurrentValue[uchChannel - 1] > iAlertLimitHigh )
562 4 {
563 5 SetFlagBit(uchChannel, 0x4);
564 5 }
565 4 else
566 4 {
567 5 if (AlarmModule.iCurrentValue[uchChannel - 1] < iAlertLimitHighFall)
568 5 {
569 6 ClearFlagBit(uchChannel, 0x4);
570 6 }
571 5 }
572 4
573 4 if ( AlarmModule.iCurrentValue[uchChannel - 1] < iAlertLimitLow )
574 4 {
575 5 SetFlagBit(uchChannel, 0x2);
576 5 }
577 4 else
578 4 {
579 5 if (AlarmModule.iCurrentValue[uchChannel - 1] > iAlertLimitLowFall)
580 5 {
581 6 ClearFlagBit(uchChannel, 0x2);
582 6 }
583 5 }
584 4
585 4 }
586 3 else if (AlarmModule.uchAlertTypeStatus[uchChannel - 1] == 2) //Gap
587 3 {
588 4 if((AlarmModule.uchAlarmStatus[uchChannel - 1] & 0x06) != 0 && AlarmModule.uchLatch[uchChannel - 1]
-== 1 )
589 4 {
590 5 if (AlarmModule.uchResetStatus[uchChannel - 1] == 1)
591 5 {
592 6 AlarmModule.uchAlarmStatus[uchChannel - 1] &= 0xF9;
593 6 }
594 5 return;
595 5 }
596 4 else
597 4 {
598 5 AlarmModule.uchAlarmStatus[uchChannel - 1] &= 0xF9;
599 5 }
600 4 }
601 3 }
602 2 else if ((AlarmModule.uchEnable[uchChannel - 1] == 1) && (AlarmModule.uchOKStatus[uchChannel - 1] != 0)
-)
603 2 {
604 3 if(AlarmModule.uchAlertTypeStatus[uchChannel - 1] == 2) //Gap 报警
605 3 {
606 4 if(AlarmModule.uchOKStatus[uchChannel - 1] == 1) //GAP 低报警
607 4 {
C51 COMPILER V7.10 ALARM 09/18/2008 14:09:31 PAGE 11
608 5 AlarmModule.uchAlarmStatus[uchChannel - 1] |= 0x02;
609 5 }
610 4 else //GAP 高报警
611 4 {
612 5 AlarmModule.uchAlarmStatus[uchChannel - 1] |= 0x04;
613 5 }
614 4
615 4 if (AlarmModule.uchLatch[uchChannel - 1] == 1)
616 4 {
617 5 if (AlarmModule.uchResetStatus[uchChannel - 1] == 1)
618 5 {
619 6 AlarmModule.uchAlarmStatus[uchChannel - 1] &= 0xF6;
620 6 }
621 5
622 5 return;
623 5 }
624 4 else
625 4 {
626 5 AlarmModule.uchAlarmStatus[uchChannel - 1] &= 0x06;
627 5 }
628 4
629 4 }
630 3 else
631 3 {
632 4 if (AlarmModule.uchLatch[uchChannel - 1] == 1)
633 4 {
634 5 if (AlarmModule.uchResetStatus[uchChannel - 1] == 1)
635 5 {
636 6 AlarmModule.uchAlarmStatus[uchChannel - 1] = 0x00;
637 6 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -