• 大小: 274KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-08
  • 语言: C#
  • 标签: 运动控制  

资源简介

简单控制,但里面的运动卡控制类还是挺全的,可以在做其他项目的时候进行参考,方便开发,运动控制,个人感觉还是用运动控制卡比较好,最起码显得高端,换句话说运动控制卡的精度会比PLC的精度要高很多。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using gts;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        static short AXIS = 2;
        short sRtn = 1;
        string str = “11“;
        string version_str;
        short index = 9;
        mc.TPid pid_me set_pid;
        int pmode;
        uint pclock;
        public Form1()
        {
            InitializeComponent();
        }
        //获取索引信息
        private void button1_Click(object sender EventArgs e)
        {

            mc.GT_GetCardNo(out index);

            MessageBox.Show(Convert.ToString(index) “索引“);

        }
        //打开
        private void button2_Click(object sender EventArgs e)
        {
            sRtn = mc.GT_Open(0 1);
            MessageBox.Show(Convert.ToString(sRtn) “打开控制卡“);
        }
        //关闭
        private void button3_Click(object sender EventArgs e)
        {
            mc.GT_Close();
        }
        //
        private void Form1_Load(object sender EventArgs e)
        {
            MessageBox.Show(Convert.ToString(index) “初始信息“);
        }
        //设置PID
        private void button4_Click(object sender EventArgs e)
        {
            set_pid.kp = 0.5;
            set_pid.ki = 0.3;
            set_pid.kd = 0.7;

            //设置有一些问题....无法进行设置。
            mc.GT_SetPid(1 1 ref set_pid);
            mc.GT_GetPid(1 1 out pid_me);
            string sb = “P参数:“ + pid_me.kp.ToString() + “ “ + “i参数“ + pid_me.ki.ToString() + “d参数“ + pid_me.kd.ToString();
            MessageBox.Show(sb “PID参数“);

        }
        //获取PID参数
        private void button5_Click(object sender EventArgs e)
        {
            mc.GT_GetPid(1 1 out pid_me);
            string sb = “P参数:“ + pid_me.kp.ToString() + “ “ + “i参数“ + pid_me.ki.ToString() + “d参数“ + pid_me.kd.ToString();
            MessageBox.Show(sb “PID参数“);

        }
        //运动模式读取
        private void button6_Click(object sender EventArgs e)
        {
            mc.GT_GetPrfMode((short)1 out pmode (short)1 out pclock);
            string a = “运动模式:“ + pmode.ToString() + “ “ + “控制器时钟:“ + pclock.ToString();
            MessageBox.Show(a “运动模式读取“);
        }

        void commandhandler(string command short error)
        {
            // 如果指令执行返回值为非0,说明指令执行错误,向屏幕输出错误结果
            if (Convert.ToBoolean(error))
            {
                MessageBox.Show(command + “=“ + Convert.ToString(sRtn) “点位运动“);
            }
        }

        //点位运动模式
        private void button7_Click(object sender EventArgs e)
        {
            /* short sRtn;
            sRtn= mc.GT_Open(0 1);
            MessageBox.Show(Convert.ToString(sRtn)“点位运动“);

             

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

    ..A..H.     55808  2020-07-09 10:26  WindowsFormsApplication1\WindowsFormsApplication1\.vs\WindowsFormsApplication1\v16\.suo

     文件        187  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\App.config

     文件      71167  2016-12-06 11:54  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\gts.cs

     文件     537600  2017-08-15 19:18  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\gts.dll

     文件      10526  2015-07-22 09:40  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\test.cfg

     文件      49152  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

     文件        187  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config

     文件      28160  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb

     文件      22472  2018-05-08 09:48  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe

     文件        187  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config

     文件        490  2012-06-06 02:06  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件       6274  2020-07-09 10:26  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs

     文件       7602  2018-05-07 11:29  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs

     文件       5817  2018-05-07 11:29  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx

     文件      71167  2018-04-23 19:38  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\gts.cs

     文件        210  2020-07-09 10:13  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\.NETframeworkVersion=v4.5.AssemblyAttributes.cs

     文件        819  2020-07-09 10:14  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7202  2020-07-09 10:13  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       4196  2018-05-08 09:48  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt

     文件        977  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache

     文件      10835  2020-07-09 10:13  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csprojAssemblyReference.cache

     文件      49152  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe

     文件        180  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Form1.resources

     文件      28160  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb

     文件        180  2018-05-07 11:33  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Properties.Resources.resources

     文件        536  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs

     文件       1368  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Properties\AssemblyInfo.cs

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

评论

共有 条评论