| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 | 
							- using System;
 
- using System.Diagnostics;
 
- using System.IO;
 
- using System.Reflection;
 
- using System.Runtime.InteropServices;
 
- using System.Xml.Serialization;
 
- namespace Aitex.Core.Util
 
- {
 
-     /// <summary>
 
-     /// 下降沿信号检测类
 
-     /// 
 
-     /// 设计目的:
 
-     /// 用于信号下降沿事件检测
 
-     /// 
 
-     /// 使用场合:
 
-     /// 系统输入数字信号,1->0跳变检测
 
-     /// </summary>
 
-     public class F_TRIG
 
-     {
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         public F_TRIG()
 
-         {
 
-             Q = false;
 
-             M = true;
 
-         }
 
-         /// <summary>
 
-         /// 检测信号输入
 
-         /// </summary>
 
-         public bool CLK
 
-         {
 
-             set
 
-             {
 
-                 if (M != value && !value)
 
-                     Q = true;
 
-                 else
 
-                     Q = false;
 
-                 M = value;
 
-             }
 
-             get
 
-             {
 
-                 return M;
 
-             }
 
-         }
 
-         //clear 
 
-         public bool RST
 
-         {
 
-             set
 
-             {
 
-                 Q = false;
 
-                 M = true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检测结果输出
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool Q { get; private set; }
 
-         /// <summary>
 
-         /// 记录上一次输入信号值
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool M { get; private set; }
 
-     }
 
-     /// <summary>
 
-     /// 实现滤波功能
 
-     /// </summary>
 
-     public class FR_TRIG
 
-     {
 
-         private bool lastValue;
 
-         private bool currentValue;
 
-         private bool output;
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         public FR_TRIG()
 
-         {
 
-             lastValue = false;
 
-             currentValue = false;
 
-             output = false;
 
-         }
 
-         /// <summary>
 
-         /// 检测信号输入
 
-         /// </summary>
 
-         public bool CLK
 
-         {
 
-             set
 
-             {
 
-                 currentValue = value;
 
-                 if (currentValue != lastValue)
 
-                 {
 
-                     output = true; // 信号变化时立即输出 true
 
-                 }
 
-                 else
 
-                 {
 
-                     output = false; // 信号不变时输出 false
 
-                 }
 
-                 lastValue = currentValue;
 
-             }
 
-             get
 
-             {
 
-                 return currentValue;
 
-             }
 
-         }
 
-         public bool RST
 
-         {
 
-             set
 
-             {
 
-                 currentValue = false;
 
-                 lastValue = false;
 
-                 output = false;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检测结果输出
 
-         /// </summary>
 
-         [System.Xml.Serialization.XmlIgnore]
 
-         public bool Q { get => output; private set => output = value; }
 
-         /// <summary>
 
-         /// 记录上一次输入信号值
 
-         /// </summary>
 
-         [System.Xml.Serialization.XmlIgnore]
 
-         public bool M { get => currentValue; private set => currentValue = value; }
 
-     }
 
-     /// <summary>
 
-     /// 上升沿信号检测类
 
-     /// 
 
-     /// 设计目的:
 
-     /// 用于信号上升沿事件检测
 
-     /// 
 
-     /// 使用场合:
 
-     /// 系统输入数字信号,0->1跳变检测
 
-     /// </summary>
 
-     public class R_TRIG
 
-     {
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         public R_TRIG()
 
-         {
 
-             Q = false;
 
-             M = false;
 
-         }
 
-         /// <summary>
 
-         /// 检测信号输入
 
-         /// </summary>
 
-         public bool CLK
 
-         {
 
-             set
 
-             {
 
-                 if (M != value && value)
 
-                     Q = true;
 
-                 else
 
-                     Q = false;
 
-                 M = value;
 
-             }
 
-             get
 
-             {
 
-                 return M;
 
-             }
 
-         }
 
-         public bool RST
 
-         {
 
-             set
 
-             {
 
-                 Q = false;
 
-                 M = false;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检测结果输出
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool Q { get; private set; }
 
-         /// <summary>
 
-         /// 记录上一次输入信号值
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool M { get; private set; }
 
-     }
 
-     /// <summary>
 
-     /// 边沿信号检测类
 
-     /// 
 
-     /// 设计目的:
 
-     /// 用于信号上升沿/下降沿事件检测
 
-     /// 
 
-     /// 使用场合:
 
-     /// 初始值为0
 
-     /// 系统输入数字信号,0->1跳变检测  Q 触发
 
-     /// 1->0 R
 
-     /// </summary>
 
-     public class RD_TRIG
 
-     {
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         public RD_TRIG()
 
-         {
 
-             R = false;
 
-             T = false;
 
-             M = false;
 
-         }
 
-         /// <summary>
 
-         /// 检测信号输入
 
-         /// </summary>
 
-         public bool CLK
 
-         {
 
-             set
 
-             {
 
-                 if (M != value)
 
-                 {
 
-                     R = value;
 
-                     T = !value;
 
-                 }
 
-                 else
 
-                 {
 
-                     R = false;
 
-                     T = false;
 
-                 }
 
-                 M = value;
 
-             }
 
-             get
 
-             {
 
-                 return M;
 
-             }
 
-         }
 
-         public bool RST
 
-         {
 
-             set
 
-             {
 
-                 R = false;
 
-                 T = false;
 
-                 M = false;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 检测结果输出, 上升沿触发 rising edge
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool R { get; private set; }
 
-         /// <summary>
 
-         /// 检测结果输出, 下降沿触发 trailing edge
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool T { get; private set; }
 
-         /// <summary>
 
-         /// 记录上一次输入信号值
 
-         /// </summary>
 
-         [XmlIgnore]
 
-         public bool M { get; private set; }
 
-     }
 
- }
 
 
  |