• 大小: 0.10M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-04-28
  • 语言: C#
  • 标签: 运动  控制  驱动  C#  

资源简介


资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using csLTDMC;

namespace 单轴点位运动
{
    public partial class Form1 : Form
    {
        private ushort _CardID = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
            short num = LTDMC.dmc_board_init();//获取卡数量
            if (num <= 0 || num > 8)
            {
                MessageBox.Show(“初始卡失败!“ “出错“);
            }
            ushort _num = 0;
            ushort[] cardids = new ushort[8];
            uint[] cardtypes = new uint[8];
            short res = LTDMC.dmc_get_CardInfList(ref _num cardtypes cardids);
            if (res != 0)
            {
                MessageBox.Show(“获取卡信息失败!“);
            }
            _CardID = cardids[0];
            //
            timer1.Start();
        }

        private ushort GetAxis()
        {
            return decimal.ToUInt16(numericUpDown1.Value);
        }
        private void SetProfile()
        {
            LTDMC.dmc_set_profile(
                _CardID
                GetAxis()
                decimal.ToDouble(numericUpDown2.Value)
                decimal.ToDouble(numericUpDown3.Value)
                decimal.ToDouble(numericUpDown4.Value)
                decimal.ToDouble(numericUpDown5.Value)
                decimal.ToDouble(numericUpDown1.Value));
            LTDMC.dmc_set_s_profile(
                _CardID
                GetAxis()
                0
                decimal.ToDouble(numericUpDown6.Value)
                );
        }

        private void button1_Click(object sender EventArgs e)
        {
            if (LTDMC.dmc_check_done(_CardID GetAxis()) == 0)
            {
                MessageBox.Show(“电机运动中请稍后尝试!“ “提示“);
                return;
            }
            else
            {
                SetProfile();
                LTDMC.dmc_pmove(_CardID GetAxis() decimal.ToInt32(numericUpDown11.Value) 0);
                LTDMC.dmc_write_outbit(_CardID decimal.ToUInt16(numericUpDown9.Value) 0);
            }
        }

        private void button2_Click(object sender EventArgs e)
        {
            if (LTDMC.dmc_check_done(_CardID GetAxis()) == 0)
            {
                MessageBox.Show(“电机运动中请稍后尝试!“ “提示“);
                return;
            }
            else
            {
                SetProfile();
                LTDMC.dmc_pmove(_CardID GetAxis() -decimal.ToInt32(numericUpDown11.Value) 0);
                LTDMC.dmc_write_outbit(_CardID decimal.ToUInt16(numericUpDown10.Value) 0);
            }
        }

        private void button3_Click(object sender EventArgs e)
        {
            LTDMC.dmc_set_position(_CardID GetAxis() 0);
        }

   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5252  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Form1.cs

     文件      35209  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Form1.Designer.cs

     文件       6008  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Form1.resx

     文件      73093  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\LTDMC.cs

     文件        501  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Program.cs

     文件       1392  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Properties\AssemblyInfo.cs

     文件       2886  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Properties\Resources.Designer.cs

     文件       5612  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Properties\Resources.resx

     文件       1103  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Properties\Settings.Designer.cs

     文件        249  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\Properties\Settings.settings

     文件       3783  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动\单轴点位运动.csproj

     文件        944  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动.sln

     文件      13824  2015-08-27 00:00  例8_单轴点位运动\Backup\单轴点位运动.suo

     文件       6093  2015-08-27 00:00  例8_单轴点位运动\UpgradeLog.xml

     文件       3348  2015-08-27 00:00  例8_单轴点位运动\_UpgradeReport_Files\UpgradeReport.css

     文件      12505  2015-08-27 00:00  例8_单轴点位运动\_UpgradeReport_Files\UpgradeReport.xslt

     文件         69  2015-08-27 00:00  例8_单轴点位运动\_UpgradeReport_Files\UpgradeReport_Minus.gif

     文件         71  2015-08-27 00:00  例8_单轴点位运动\_UpgradeReport_Files\UpgradeReport_Plus.gif

     文件      40960  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\bin\Debug\单轴点位运动.exe

     文件      38400  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\bin\Debug\单轴点位运动.pdb

     文件      11608  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\bin\Debug\单轴点位运动.vshost.exe

     文件        490  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\bin\Debug\单轴点位运动.vshost.exe.manifest

     文件       5252  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\Form1.cs

     文件      35209  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\Form1.Designer.cs

     文件       6008  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\Form1.resx

     文件      73093  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\LTDMC.cs

     文件       6469  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        614  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\obj\Debug\GenerateResource-ResGen.read.1.tlog

     文件        990  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\obj\Debug\GenerateResource-ResGen.write.1.tlog

     文件       4608  2015-08-27 00:00  例8_单轴点位运动\单轴点位运动\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

............此处省略30个文件信息

评论

共有 条评论