Beispiel #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            // ushort axis = GetAxis(); //轴号
            double dcurrent_speedX = 0, dcurrent_speedY = 0, dcurrent_speedZ = 0, dcurrent_speedW = 0; //速度值
            //  double dunitPosX, dunitPosY, dunitPosZ, dunitPosW; //脉冲当量转换后指令值
            int PosX, PosY, PosZ, PosW;                                                                //脉冲值

            LTDMC.dmc_read_current_speed_unit(_CardID, 0, ref dcurrent_speedX);                        // 读取轴当前速度
            LTDMC.dmc_read_current_speed_unit(_CardID, 1, ref dcurrent_speedY);
            LTDMC.dmc_read_current_speed_unit(_CardID, 2, ref dcurrent_speedZ);
            LTDMC.dmc_read_current_speed_unit(_CardID, 3, ref dcurrent_speedW);
            txtCurrentSpeedX.Text = dcurrent_speedX.ToString();
            txtCurrentSpeedY.Text = dcurrent_speedY.ToString();
            txtCurrentSpeedZ.Text = dcurrent_speedZ.ToString();
            txtCurrentSpeedW.Text = dcurrent_speedW.ToString();
            //LTDMC.dmc_get_position_unit(_CardID, 0, ref dunitPosX); //读取指定轴指令位置值
            //txtFinalPosY.Text = dunitPosX.ToString();
            PosX = LTDMC.dmc_get_position(_CardID, 0);//读取指定轴的脉冲值
            PosY = LTDMC.dmc_get_position(_CardID, 1);
            PosZ = LTDMC.dmc_get_position(_CardID, 2);
            PosW = LTDMC.dmc_get_position(_CardID, 3);
            txtCurrentPosX.Text = PosX.ToString();
            txtCurrentPosY.Text = PosY.ToString();
            txtCurrentPosZ.Text = PosZ.ToString();
            txtCurrentPosW.Text = PosW.ToString();
            if (LTDMC.dmc_check_done(_CardID, 0) == 0) // 读取指定轴运动状态
            {
                txtStateX.Text = "运行中";
            }
            else
            {
                txtStateX.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 1) == 0) // 读取指定轴运动状态
            {
                txtStateY.Text = "运行中";
            }
            else
            {
                txtStateY.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 2) == 0) // 读取指定轴运动状态
            {
                txtStateZ.Text = "运行中";
            }
            else
            {
                txtStateZ.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 3) == 0) // 读取指定轴运动状态
            {
                txtStateW.Text = "运行中";
            }
            else
            {
                txtStateW.Text = "停止中";
            }
        }
Beispiel #2
0
 public override string ToString()
 {
     return(String.Format("[{0}][{1}],[{2}],[{3}],[{4}],[{5}],[{6}],[{7}],[{8}],[{9}]", (Frame + 1).ToString().PadLeft(5),
                          PosX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotW.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaZ.ToString().ToFixedString(size, ' ').PadRight(padding)));
 }