资源简介


资源截图

代码片段和文件信息

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 csLTDMC;  // 引入DMC运动控制卡的类库
namespace 练习
{
    public partial class Form1 : Form
    {

        private ushort CardID = 0;  // 卡号为0

        private ushort axis = 0;  // 轴号为0

        private double MaxSpeed;

        private int Distance;




        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender EventArgs e)
        {

        }

        private void label5_Click(object sender EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender EventArgs e)
        {

        }

        private void Form1_Load(object sender EventArgs e)
        {
            LTDMC.dmc_board_init();   // 初始化运动控制卡

            LTDMC.dmc_set_pulse_outmode(CardID axis 0);  //设置脉冲模式

            timer1.Interval = 200;  // 定时器间隔时间为200毫秒

            timer1.Stop();

        }

        private void Form1_FormClosed(object sender FormClosedEventArgs e)  // 窗体关闭事件

        {

            LTDMC.dmc_board_close();  // 关闭运动控制卡

        }

        private void timer1_Tick(object sender EventArgs e)
        {
            long Position = LTDMC.dmc_get_position(CardID axis);  // 读取X轴当前指令位置

            textBox3.Text = Convert.ToString(Position); // 显示位置信息

            if (LTDMC.dmc_check_done(CardID axis) == 1)

                timer1.Stop();   // 电机停止,关闭定时器
        }

        private void textBox3_TextChanged(object sender EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender EventArgs e)
        {

        }

        private void button3_Click(object sender EventArgs e)
        {
            LTDMC.dmc_stop(CardID axis 0); // 减速停止
        }

        private void button4_Click(object sender EventArgs e)
        {
            LTDMC.dmc_set_position(CardID axis 0);  // 设置X轴的脉冲位置为0

            textBox3.Text = “0“;  // 显示初始位置信息
        }

        private void button2_Click(object sender EventArgs e)
        {
            if (LTDMC.dmc_check_done(CardID axis) == 0)

                return;  // 电机未停止运动

            MaxSpeed = Convert.ToDouble(textBox2.Text);

            Distance = Convert.ToInt32(textBox3.Text);

            LTDMC.dmc_set_s_profile(CardID axis 0 0.05);  //设置S段时间(0~0.5s)

            LTDMC.dmc_set_profile(CardID axis 100 MaxSpeed 0.1 0.1 100);  //设置起始速度、运行速度、加速时间、减速时间、停止速度

            LTDMC.dmc_pmove(CardID axis Distance 0);  //定长运动

            timer1.Start(); //打开定时器
        }

        private void button1_Click(object sender EventArgs e)
        {
            if (LTDMC.dmc_check_done(CardID axis) == 0)

                return;  // 电机未停止运动

            MaxSpeed = C

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-08-20 09:59  c#2020\
     目录           0  2020-08-20 09:59  c#2020\练习\
     目录           0  2020-08-20 09:59  c#2020\练习\.vs\
     目录           0  2020-08-20 09:59  c#2020\练习\.vs\练习\
     目录           0  2020-08-20 09:59  c#2020\练习\.vs\练习\v15\
     文件       26112  2020-08-19 16:59  c#2020\练习\.vs\练习\v15\.suo
     目录           0  2020-08-20 09:59  c#2020\练习\.vs\练习\v15\Server\
     目录           0  2020-08-20 09:59  c#2020\练习\.vs\练习\v15\Server\sqlite3\
     文件      729088  2020-08-19 10:45  c#2020\练习\.vs\练习\v15\Server\sqlite3\storage.ide
     文件       32768  2020-08-20 09:50  c#2020\练习\.vs\练习\v15\Server\sqlite3\storage.ide-shm
     文件     4185952  2020-08-19 17:00  c#2020\练习\.vs\练习\v15\Server\sqlite3\storage.ide-wal
     文件         189  2020-08-19 09:50  c#2020\练习\App.config
     文件       10942  2020-08-19 14:38  c#2020\练习\Form1.Designer.cs
     文件        3827  2020-08-19 14:38  c#2020\练习\Form1.cs
     文件        6011  2020-08-19 14:38  c#2020\练习\Form1.resx
     文件        1471  2020-08-19 16:59  c#2020\练习\Form2.Designer.cs
     文件         474  2020-08-19 16:59  c#2020\练习\Form2.cs
     文件        5817  2020-08-19 16:59  c#2020\练习\Form2.resx
     文件      171909  2019-11-22 14:25  c#2020\练习\LTDMC.cs
     文件         518  2020-08-19 09:50  c#2020\练习\Program.cs
     目录           0  2020-08-20 09:59  c#2020\练习\Properties\
     文件        1310  2020-08-19 09:50  c#2020\练习\Properties\AssemblyInfo.cs
     文件        2825  2020-08-19 09:50  c#2020\练习\Properties\Resources.Designer.cs
     文件        5612  2020-08-19 09:50  c#2020\练习\Properties\Resources.resx
     文件        1093  2020-08-19 09:50  c#2020\练习\Properties\Settings.Designer.cs
     文件         249  2020-08-19 09:50  c#2020\练习\Properties\Settings.settings
     目录           0  2020-08-20 09:59  c#2020\练习\bin\
     目录           0  2020-08-20 09:59  c#2020\练习\bin\Debug\
     文件      753664  2019-11-14 11:31  c#2020\练习\bin\Debug\LTDMC.dll
     文件       76288  2020-08-19 14:39  c#2020\练习\bin\Debug\练习.exe
     文件         189  2020-08-19 09:50  c#2020\练习\bin\Debug\练习.exe.config
............此处省略19个文件信息

评论

共有 条评论