private void MoveNegModbus()
 {
     if (State.IsCon)
     {
         Mbus.WriteModbusQueue(1, 2000, 3, false);
         State.IsMoving = true;
     }
 }
 internal new void Connect()
 {
     //attempt to sync with motor
     //int speed = (int)((double)nmSpiRPM.Value * 2.122);
     //int speed = (int)((double)nmSpiRPM.Value * 3.772);
     //int speed = (int)((double)nmSpiRPM.Value * 3.7022); //Adjusted by BG and CC on 9/7/12
     if (Mbus.WriteModbusQueue(1, 2000, 0, true))
     {
         State.IsCon = true;
         //message = "Spindle Connected";
     }
     else
     {
         State.IsCon = false;
     }
     //message = "Spindle Failed to connect";
 }
        //This function moves the Lateral Motor checking for direction and speed changes
        internal new void MoveModbus(double velocity, double scale)
        {
            bool   change, dir;
            double speed;

            (change, dir, speed) = State.ChangeVelocity(velocity);
            if (change)
            {
                //old pulley speed
                // int speed = (int)((double)nmSpiRPM.Value * 1.58);
                // int speed = (int)(RPM * 2.122);
                //int speed = (int)(RPM * 3.7022); //Adjusted by BG and CC 9/7/12
                Mbus.WriteModbusQueue(1, 2002, (int)(speed * 3.772), false);
                if (dir)
                {
                    MovePosModbus();
                }
                else
                {
                    MoveNegModbus();
                }
            }
        }
 private new void Disconnect()
 {
     Mbus.WriteModbusQueue(1, 2000, 0, false);
     State.IsCon = false;
 }
 public new void Hault()//Stop the Spindle Motor
 {
     //Stop the spindle
     Mbus.WriteModbusQueue(1, 2000, 0, false);
 }