資源簡介
代碼片段和文件信息
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];
????????????//
????????????timer1.Start();
????????}
????????private?ushort?GetAxis()
????????{
????????????ushort?axis?=?0;
????????????if?(radioButton1.Checked)
????????????{
????????????????axis?=?0;
????????????}
????????????else?if?(radioButton2.Checked)
????????????{
????????????????axis=?1;
????????????}
????????????else?if?(radioButton3.Checked)
????????????{
????????????????axis?=?2;
????????????}
????????????else?if?(radioButton4.Checked)
????????????{
????????????????axis?=?3;
????????????}
????????????return?axis;
????????}
????????//運行
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis=GetAxis();
????????????double?start?=?decimal.ToDouble(numericUpDown1.Value);
????????????double?speed=decimal.ToDouble(numericUpDown2.Value);
????????????double?stop=decimal.ToDouble(numericUpDown3.Value);
????????????double?acc=decimal.ToDouble(numericUpDown4.Value);
????????????double?dec=decimal.ToDouble(numericUpDown5.Value);
????????????int?dis=decimal.ToInt32(numericUpDown6.Value);
????????????//
????????????LTDMC.dmc_set_pulse_outmode(_CardID?axis?0);//設置脈沖模式
????????????LTDMC.dmc_set_s_profile(_CardID?axis?0?0.01);//設置S段時間(0-0.05s)
????????????LTDMC.dmc_set_profile(_CardID?axis?start?speed?acc?dec?stop);//設置起始速度、運行速度、停止速度、加速時間、減速時間
????????????LTDMC.dmc_pmove(_CardID?axis?dis?0);//定長運動
????????????//
????????}
????????//位置清零
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();
????????????LTDMC.dmc_set_position(_CardID?axis?0);//位置清零
????????}
????????//減速停止
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();
????????????LTDMC.dmc_stop(_CardID?axis?0);
????????}
????????//在線變速
????????private?void?button4_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();
????????????double?speed?=?decimal.ToDouble(numericUpDown2.Value);
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????40448??2020-10-07?10:41??例1_定長運動\.vs\定長運動\v16\.suo
?????文件???????5300??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Form1.cs
?????文件??????21540??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Form1.Designer.cs
?????文件???????6008??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Form1.resx
?????文件??????73093??2015-08-27?00:00??例1_定長運動\Backup\定長運動\LTDMC.cs
?????文件????????495??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Program.cs
?????文件???????1380??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Properties\AssemblyInfo.cs
?????文件???????2874??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Properties\Resources.Designer.cs
?????文件???????5612??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Properties\Resources.resx
?????文件???????1097??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Properties\Settings.Designer.cs
?????文件????????249??2015-08-27?00:00??例1_定長運動\Backup\定長運動\Properties\Settings.settings
?????文件???????3806??2015-08-27?00:00??例1_定長運動\Backup\定長運動\定長運動.csproj
?????文件????????926??2015-08-27?00:00??例1_定長運動\Backup\定長運動.sln
?????文件??????14848??2015-08-27?00:00??例1_定長運動\Backup\定長運動.suo
?????文件???????3899??2015-08-27?00:00??例1_定長運動\UpgradeLog.xm
?????文件???????3348??2015-08-27?00:00??例1_定長運動\_UpgradeReport_Files\UpgradeReport.css
?????文件??????12505??2015-08-27?00:00??例1_定長運動\_UpgradeReport_Files\UpgradeReport.xslt
?????文件?????????69??2015-08-27?00:00??例1_定長運動\_UpgradeReport_Files\UpgradeReport_Minus.gif
?????文件?????????71??2015-08-27?00:00??例1_定長運動\_UpgradeReport_Files\UpgradeReport_Plus.gif
?????文件??????36352??2020-10-05?15:38??例1_定長運動\定長運動\bin\Debug\定長運動.exe
?????文件??????32256??2020-10-05?15:38??例1_定長運動\定長運動\bin\Debug\定長運動.pdb
?????文件??????22472??2017-01-08?17:33??例1_定長運動\定長運動\bin\Debug\定長運動.vshost.exe
?????文件????????490??2016-07-16?19:44??例1_定長運動\定長運動\bin\Debug\定長運動.vshost.exe.manifest
?????文件???????5300??2020-10-05?17:13??例1_定長運動\定長運動\Form1.cs
?????文件??????24132??2020-10-05?17:13??例1_定長運動\定長運動\Form1.Designer.cs
?????文件???????6008??2020-10-05?17:13??例1_定長運動\定長運動\Form1.resx
?????文件???????2065??2020-10-07?10:19??例1_定長運動\定長運動\Image1.gif
?????文件??????73093??2015-08-27?00:00??例1_定長運動\定長運動\LTDMC.cs
?????文件????????208??2020-10-05?15:37??例1_定長運動\定長運動\obj\Debug\.NETfr
?????文件???????1423??2020-10-05?17:08??例1_定長運動\定長運動\obj\Debug\DesignTimeResolveAssemblyReferences.cache
............此處省略43個文件信息
- 上一篇:科大訊飛語音轉換
- 下一篇:C#網站項目使用SignalR技術實現實時聊天
評論
共有 條評論