public static int Initialize(CounterMode mode, out int index) { int idx = 0; var ret = lowLevel.HAL_InitializeCounter(mode, &idx); index = idx; return(ret); }
public void SetMode(CounterMode mode) { if (State == CounterState.Working) { throw new Exception("Нельзя изменить способ подсчёта во время работы счётчика"); } Mode = mode; }
/// <summary> /// 创建时间计数器. /// </summary> /// <param name="iMaxValue">计数器最大值.</param> /// <param name="iOnCountOver">超过计时回调函数.</param> /// <param name="iMode">模式(默认为:倒计时).</param> public static TimeCounter Create( float iMaxValue, System.Action <float, float> iOnCountOver = null, CounterMode iMode = CounterMode.CountDown) { var objRet = new TimeCounter(); objRet.InitCounter(iMaxValue, CounterType.TimeCounter, iMode); if (iOnCountOver != null) { objRet.OnCounterUpdated += iOnCountOver; } return(objRet); }
/// <summary> /// Initialize a new <see cref="Counter"/> instance with the given parameters. /// </summary> /// <param name="name">The name of the counter.</param> /// <param name="description">The description of the counter.</param> /// <param name="mode">The mode of the counter sampling.</param> /// <param name="displayType">The default display mode for the counter.</param> public Counter(string name, string description, CounterMode mode, CounterDisplayType displayType) { this.Mode = mode; this.Name = name; this.Description = description; // HACK this.Mode = CounterMode.Historical; if (this.Mode == CounterMode.Historical) { this.History = new CircularList <double>(CounterHistorySize, true); } this.DisplayType = displayType; }
public Counter(int number, CounterMode mode, string file, int speed1 = 250, int speed2 = 500) { State = CounterState.Ready; Mode = mode; Number = number; File = file; sw = new StreamWriter(File); OddThreadSpeed = speed1; EvenThreadSpeed = speed2; oddThread = new Thread(new ThreadStart(Odd)); evenThread = new Thread(new ThreadStart(Even)); oddThreadNum = 1; evenThreadNum = 2; firstTurn = true; }
public CTSetup(CTChannel AIMyPanel) { m_CTPanel = AIMyPanel; InitializeComponent(); rbIncremental.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.INCREMENTALCOUNTER); rbIncExtFlow.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.INCEEXTFLOWRATE); rbIncExtTime.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.INCEEXTTIMESTAMP); rbImpulse.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.IMPULSECOUNTER); rbFreq.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.FREQUENCYCOUNTER); rbPeriod.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.PERIODCOUNTER); rbPulsewidth.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.PULSEWIDTHCOUNTER); rbUpDown.Enabled = m_CTPanel.Channel.IsCounterModeAvailable(CounterMode.UPDOWNCOUNTER); checkBoxSyncToAD.Enabled = m_CTPanel.Channel.MyDevice.IsDSPDevice; Mode = m_CTPanel.Mode; checkBoxSyncToAD.Checked = m_CTPanel.ADSync; }
/// <summary> /// 初始化计数器. /// </summary> /// <param name="iMaxValue">最大值.</param> /// <param name="iType">类型.</param> /// <param name="iMode">模式.</param> /// <param name="iInterval">更新时间间隔(单位:100毫微秒).</param> public abstract void InitCounter( T iMaxValue, CounterType iType, CounterMode iMode = CounterMode.CountDown, long iInterval = 0L);
/// <summary> /// Initialize a new <see cref="Counter"/> instance with the given parameters. /// </summary> /// <param name="name">The name of the counter.</param> /// <param name="description">The description of the counter.</param> /// <param name="mode">The mode of the counter sampling.</param> public Counter(string name, string description, CounterMode mode) : this(name, description, mode, CounterDisplayType.LastValue) { }
private void rbGrouShuffle_CheckedChanged(object sender, EventArgs e) => _currentMode = CounterMode.GroupShuffle;
private void rbReverseQueue_CheckedChanged(object sender, EventArgs e) => _currentMode = CounterMode.ReverseQueue;
private void rbAll_CheckedChanged(object sender, EventArgs e) => _currentMode = CounterMode.All;
/// <summary> /// Initialize a new <see cref="Counter"/> instance with the given parameters. /// </summary> /// <param name="name">The name of the counter.</param> /// <param name="description">The description of the counter.</param> /// <param name="mode">The mode of the counter sampling.</param> /// <param name="displayType">The default display mode for the counter.</param> public Counter( string name, string description, CounterMode mode, CounterDisplayType displayType ) { this.Mode = mode; this.Name = name; this.Description = description; // HACK this.Mode = CounterMode.Historical; if( this.Mode == CounterMode.Historical ) this.History = new CircularList<double>( CounterHistorySize, true ); this.DisplayType = displayType; }
/// <summary> /// Initialize a new <see cref="Counter"/> instance with the given parameters. /// </summary> /// <param name="name">The name of the counter.</param> /// <param name="description">The description of the counter.</param> /// <param name="mode">The mode of the counter sampling.</param> public Counter( string name, string description, CounterMode mode ) : this(name, description, mode, CounterDisplayType.LastValue) { }