資源簡介
簡單控制,但里面的運動卡控制類還是挺全的,可以在做其他項目的時候進行參考,方便開發(fā),運動控制,個人感覺還是用運動控制卡比較好,最起碼顯得高端,換句話說運動控制卡的精度會比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)?“打開控制卡“);
????????}
????????//關(guān)閉
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
????????????mc.GT_Close();
????????}
????????//
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????MessageBox.Show(Convert.ToString(index)?“初始信息“);
????????}
????????//設(shè)置PID
????????private?void?button4_Click(object?sender?EventArgs?e)
????????{
????????????set_pid.kp?=?0.5;
????????????set_pid.ki?=?0.3;
????????????set_pid.kd?=?0.7;
????????????//設(shè)置有一些問題....無法進行設(shè)置。
????????????mc.GT_SetPid(1?1?ref?set_pid);
????????????mc.GT_GetPid(1?1?out?pid_me);
????????????string?sb?=?“P參數(shù):“?+?pid_me.kp.ToString()?+?“?“?+?“i參數(shù)“?+?pid_me.ki.ToString()?+?“d參數(shù)“?+?pid_me.kd.ToString();
????????????MessageBox.Show(sb?“PID參數(shù)“);
????????}
????????//獲取PID參數(shù)
????????private?void?button5_Click(object?sender?EventArgs?e)
????????{
????????????mc.GT_GetPid(1?1?out?pid_me);
????????????string?sb?=?“P參數(shù):“?+?pid_me.kp.ToString()?+?“?“?+?“i參數(shù)“?+?pid_me.ki.ToString()?+?“d參數(shù)“?+?pid_me.kd.ToString();
????????????MessageBox.Show(sb?“PID參數(shù)“);
????????}
????????//運動模式讀取
????????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)
????????{
????????????//?如果指令執(zhí)行返回值為非0,說明指令執(zhí)行錯誤,向屏幕輸出錯誤結(jié)果
????????????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\.NETfr
?????文件????????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個文件信息
- 上一篇:VA_X_Setup2366.zip
- 下一篇:用C#編寫的LL1分析器
評論
共有 條評論