資源簡介
配置了運動控制卡的動態庫,實現了簡單的對話框界面并利用動態庫實現了指定電機脈沖的輸出,在運動控制卡上測試可以使用。

代碼片段和文件信息
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個文件信息
評論
共有 條評論