• 大小: 0.27M
    文件类型: .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];
            LTDMC.dmc_set_pulse_outmode(_CardID 0 0);//设置脉冲模式
            LTDMC.dmc_set_pulse_outmode(_CardID 1 0);//设置脉冲模式
            LTDMC.dmc_set_pulse_outmode(_CardID 2 0);//设置脉冲模式
            LTDMC.dmc_set_pulse_outmode(_CardID 3 0);//设置脉冲模式
            //
            timer1.Start();
        }

        private ushort GetCrd()
        {
            return decimal.ToUInt16(numericUpDown5.Value);
        }
        //运行
        private void button1_Click(object sender EventArgs e)
        {
            ushort crd = GetCrd();
            double speed = decimal.ToDouble(numericUpDown6.Value);
            double acc = decimal.ToDouble(numericUpDown7.Value);
            double dec = decimal.ToDouble(numericUpDown8.Value);
            //
            ushort num=2;
            if(radioButton1.Checked)
            {
                num=2;
            }
            else if(radioButton2.Checked)
            {
                num=3;
            }
            else if(radioButton3.Checked)
            {
                num=4;
            }
            ushort[] axis=new ushort[num];
            for (int i=0;i            {
                axis[i]=(ushort)i;
            }
            int[] pos=new int[num];
            if(num>=1)
            {
                pos[0]=decimal.ToInt32(numericUpDown1.Value);
            }
            if(num>=2)
            {
                pos[1]=decimal.ToInt32(numericUpDown2.Value);
            }
            if(num>=3)
            {
                pos[2]=decimal.ToInt32(numericUpDown3.Value);
            }
            if(num>=4)
            {
                pos[3]=decimal.ToInt32(numericUpDown4.Value);
            }
            //
            LTDMC.dmc_set_vector_profile_multicoor(_CardID crd 0 speed acc dec 0);
            LTDMC.dmc_line_multicoor(_CardID crd num axis pos 0);
            //
        }
        //位置清零
        private void button2_Click(object sender

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

     文件       4694  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Form1.cs

     文件      22245  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Form1.Designer.cs

     文件       6008  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Form1.resx

     文件      73093  2015-08-27 00:00  例5_直线插补\Backup\直线插补\LTDMC.cs

     文件        495  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Program.cs

     文件       1380  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Properties\AssemblyInfo.cs

     文件       2874  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Properties\Resources.Designer.cs

     文件       5612  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Properties\Resources.resx

     文件       1097  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Properties\Settings.Designer.cs

     文件        249  2015-08-27 00:00  例5_直线插补\Backup\直线插补\Properties\Settings.settings

     文件       3771  2015-08-27 00:00  例5_直线插补\Backup\直线插补\直线插补.csproj

     文件        926  2015-08-27 00:00  例5_直线插补\Backup\直线插补.sln

     文件      14848  2015-08-27 00:00  例5_直线插补\Backup\直线插补.suo

     文件       5685  2015-08-27 00:00  例5_直线插补\UpgradeLog.xml

     文件       3348  2015-08-27 00:00  例5_直线插补\_UpgradeReport_Files\UpgradeReport.css

     文件      12505  2015-08-27 00:00  例5_直线插补\_UpgradeReport_Files\UpgradeReport.xslt

     文件         69  2015-08-27 00:00  例5_直线插补\_UpgradeReport_Files\UpgradeReport_Minus.gif

     文件         71  2015-08-27 00:00  例5_直线插补\_UpgradeReport_Files\UpgradeReport_Plus.gif

     文件      37376  2015-08-27 00:00  例5_直线插补\直线插补\bin\Debug\直线插补.exe

     文件      40448  2015-08-27 00:00  例5_直线插补\直线插补\bin\Debug\直线插补.pdb

     文件      11608  2015-08-27 00:00  例5_直线插补\直线插补\bin\Debug\直线插补.vshost.exe

     文件        490  2015-08-27 00:00  例5_直线插补\直线插补\bin\Debug\直线插补.vshost.exe.manifest

     文件       4694  2015-08-27 00:00  例5_直线插补\直线插补\Form1.cs

     文件      22650  2015-08-27 00:00  例5_直线插补\直线插补\Form1.Designer.cs

     文件       6008  2015-08-27 00:00  例5_直线插补\直线插补\Form1.resx

     文件      73093  2015-08-27 00:00  例5_直线插补\直线插补\LTDMC.cs

     文件       6433  2015-08-27 00:00  例5_直线插补\直线插补\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        888  2015-08-27 00:00  例5_直线插补\直线插补\obj\Debug\GenerateResource-ResGen.read.1.tlog

     文件        950  2015-08-27 00:00  例5_直线插补\直线插补\obj\Debug\GenerateResource-ResGen.write.1.tlog

     文件     435200  2015-08-27 00:00  例5_直线插补\直线插补\obj\Debug\LTDMC.dll

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

评论

共有 条评论