public void Upstate() { int state = Dmc1000.d1000_get_axis_status(2); int NLimitBit = (state >> 0) & 1; int PLimitBit = (state >> 1) & 1; int OrgBit = (state >> 2) & 1; if (NLimitBit == 1) { this.N_LimitSts = IOSts.High; } else { this.N_LimitSts = IOSts.Low; } if (PLimitBit == 1) { this.P_LimitSts = IOSts.High; } else { this.P_LimitSts = IOSts.Low; } if (OrgBit == 1) { this.OrgSts = IOSts.High; } else { this.OrgSts = IOSts.Low; } }
private void ReadCurrSts() { int state = Dmc1000.d1000_in_bit((int)this.Name); //将读取到的状态取反 if (state == 0) { state = 1; } else { state = 0; } if (state == 0) { if (this.PreSts == IOSts.High) { this.CurrSts = IOSts.IsFalling; this.pulseStartTime = DateTime.Now; } else { this.CurrSts = IOSts.Low; } } else { if (this.PreSts == IOSts.Low) { this.CurrSts = IOSts.IsRising; this.pulseStartTime = DateTime.Now; } else { this.CurrSts = IOSts.High; } } }