public void uStep(bool state) { string c = (state) ? "CB2" : "SB2"; string r = DMC1425.command(c); uStepState = state; }
public async void MotorOff() { string m = (MotorType == tMotorType.DC) ? "A" : "B"; string c = (MotorType == tMotorType.DC) ? "CB3" : "SB1"; string r = DMC1425.command(c, "\r", ":", true); // Disable Power await Task.Delay(msgDelay); }
public string SendValue(string command, string value, tMotorType moteur, bool abs) { string m = (moteur == tMotorType.DC)?"A=":"B="; if ((command == "PR") && (abs)) // seulement si PR --> PA { command = command.Substring(0, 1) + "A"; } command += m + value; return(DMC1425.command(command, "\r", ":", true)); }
public async void Move(string command, string value) { string relMov = ""; if (!IsMov && MotorState) // You cannot give another BG command until current BG motion has been completed EHe/Galil { string m = (MotorType == tMotorType.DC) ? "A" : "B"; string r = DMC1425.command(command + m + "=" + value, "\r", ":", true); relMov = DMC1425.command("PR ?,?", "\r", ":", true); // EHe // await Task.Delay(msgDelay); // EHe // Thread.Sleep(msgDelay); // EHe DMC1425.command("BG" + m, "\r", ":", true); } }
public void UpdateValues(Motor mDC, Motor mPAP) { try { // mDC.CPosition = (int)DMC1425.commandValue("PR?"); // EHe 014.10.08, PA? <> PR? !!! mDC.CSpeed = (int)DMC1425.commandValue("SP?"); mDC.CAcceleration = (int)DMC1425.commandValue("AC?"); mDC.CDeceleration = (int)DMC1425.commandValue("DC?"); mDC.KP = (float)DMC1425.commandValue("KP?"); mDC.KD = (float)DMC1425.commandValue("KD?"); mDC.KI = (float)DMC1425.commandValue("KI?"); // mPAP.CPosition = (int)DMC1425.commandValue("PR,?"); // EHe 014.10.08, PA? <> PR? !!! mPAP.CSpeed = (int)DMC1425.commandValue("SP,?"); // mPAP.CSpeed = (int)DMC1425.commandValue("SPB=?"); mPAP.CAcceleration = (int)DMC1425.commandValue("AC,?"); mPAP.CDeceleration = (int)DMC1425.commandValue("DC,?"); Object r = DMC1425.record("QR"); mDC.IsMov = Convert.ToBoolean(DMC1425.sourceValue(r, "_BGA")); mDC.Position = (int)DMC1425.sourceValue(r, "_TPA"); mDC.Speed = (int)DMC1425.sourceValue(r, "_TVA"); mDC.PosErr = (int)DMC1425.sourceValue(r, "_TEA"); mDC.UCommand = DMC1425.sourceValue(r, "_TTA"); mDC.powEnable = Convert.ToBoolean(DMC1425.sourceValue(r, "@OUT[03]")); mDC.MotorState = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOA")) && mDC.powEnable; mPAP.IsMov = Convert.ToBoolean(DMC1425.sourceValue(r, "_BGB")); mPAP.Position = (int)DMC1425.sourceValue(r, "_TDB"); mPAP.powEnable = !Convert.ToBoolean(DMC1425.sourceValue(r, "@OUT[01]")); bool frage = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")); mPAP.MotorState = frage && mPAP.powEnable; //mPAP.MotorState = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")) && mPAP.powEnable; // mPAP.MotorState = /* !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")) && */ mPAP.powEnable; // EHe 014.10.08 } catch (Exception) { throw; } }
public async void MotorOn() { string m = (MotorType == tMotorType.DC) ? "A" : "B"; string c = (MotorType == tMotorType.DC) ? "SB3" : "CB1"; DMC1425.commandValue("SH" + m); // Both motors ! Reset erreur moteur DC // EHe 014.10.08 string r = DMC1425.command(c); // Enable Power await Task.Delay(msgDelay); int op = (int)DMC1425.commandValue("OP?"); if ((((op & 4) == 0) && (MotorType == tMotorType.DC)) || (((op & 1) != 0) && (MotorType == tMotorType.PAP))) { MessageBox.Show("Commutateur de puissance du moteur " + ((MotorType == tMotorType.DC) ? "DC" : "PAP") + " forcé sur DISABLE"); } else { await Task.Delay(msgDelay); } }
public void resPos() { string m = (MotorType == tMotorType.DC) ? "A" : "B"; string r = DMC1425.command("DP" + m + "=0", "\r", ":", true); }
public void Reset() { DMC1425.command("RS", "\r", ":", true); }
public string Stop() { string m = (MotorType == tMotorType.DC) ? "A" : "B"; return(DMC1425.command("ST" + m, "\r", ":", true)); }
public void Connect() { ControllerInfo = DMC1425.connection(); }