• 大小: 262KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-11-11
  • 语言: 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.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_meset_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(01);
             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(11ref 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(11out 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)1out pmode(short)1out 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.Sho

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

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

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

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

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

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

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

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

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

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

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

     文件       6459  2018-05-08 10:35  WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs

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

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

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

     文件        863  2018-05-08 09:48  WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7440  2018-05-08 09:47  WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

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

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

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

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

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

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

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

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

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

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

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

     文件       2900  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.Designer.cs

     文件       5612  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.resx

     文件       1111  2018-04-23 10:15  WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.Designer.cs

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

评论

共有 条评论