From 93e9d8d222c739316ff9fb54236302c264c45e6b Mon Sep 17 00:00:00 2001 From: xin Date: Thu, 10 Sep 2020 17:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E5=8F=8C=E6=AD=A5=E8=BF=9B=E7=94=B5=E6=9C=BA=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- testdll/testdll.vcxproj.user | 4 ++-- testdll/x64/Debug/main.obj | Bin 218718 -> 218718 bytes testdll/x64/Debug/moc_testdll.obj | Bin 222768 -> 222768 bytes testdll/x64/Debug/testdll.log | 15 +++++++++++--- testdll/x64/Debug/testdll.obj | Bin 432244 -> 432244 bytes testdll/x64/Debug/testdll.tlog/CL.read.1.tlog | Bin 204926 -> 204926 bytes .../x64/Debug/testdll.tlog/CL.write.1.tlog | Bin 4990 -> 4990 bytes .../x64/Debug/testdll.tlog/cl.command.1.tlog | Bin 12234 -> 12234 bytes .../x64/Debug/testdll.tlog/link.read.1.tlog | Bin 4722 -> 5026 bytes testdll/x64/Debug/vc120.pdb | Bin 2060288 -> 2060288 bytes vincecontrol.cpp | 19 ++++++++++++++++++ vincecontrol.h | 12 +++++++++++ vincecontrol.vcxproj.user | 11 +++++++--- 14 files changed, 58 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cde562d..b843433 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,8 @@ 新加内容 -5、设置加减速度 SettingUpandDownSpeed(int addspeed, int downspeed) \ No newline at end of file +5、设置加减速度 SettingUpandDownSpeed(int addspeed, int downspeed) + +2020-9-10: +增加了关于双步进电机同步运行 函数如下: +void setSyncMode(); 调用该函数后 改类就变成双步进电机了(nettcp+RS485协议) \ No newline at end of file diff --git a/testdll/testdll.vcxproj.user b/testdll/testdll.vcxproj.user index 75b63ac..f6dc15b 100644 --- a/testdll/testdll.vcxproj.user +++ b/testdll/testdll.vcxproj.user @@ -3,10 +3,10 @@ C:\Qt\Qt5.8.0\5.8\msvc2013_64 - PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) + PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) C:\Qt\Qt5.8.0\5.8\msvc2013_64 - PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) + PATH="$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) \ No newline at end of file diff --git a/testdll/x64/Debug/main.obj b/testdll/x64/Debug/main.obj index 849dd6973a21ae856b9df732ee5e44893cb551b2..4312841e1a760ad36cdafb791407e2e6914058db 100644 GIT binary patch delta 40 ycmV+@0N4NCtPS3*4F_a~!U5&~QGo}w2LX)C14;k@m(H32KZn)K0k_r60*Q%j6A{(` delta 40 ycmV+@0N4NCtPS3*4F_a~!U4;XP=N=v2LX)C14sY>m(H32KZn)K0k_r60*Q%T+7U|t diff --git a/testdll/x64/Debug/moc_testdll.obj b/testdll/x64/Debug/moc_testdll.obj index d396aca6bf543737d0fcd660f69bf0aedd3378d0..88277c9638a66c550d26fa639da42c565f088796 100644 GIT binary patch delta 45 zcmV+|0Mh@k%nh*24F_a~!~y01QGo}w2LUkA14;k@m(Y^|Hm(Y^|H项目“D:\vspro\ProjectofIrisIMAGE\vincecontrol\vincecontrol\testdll\testdll.vcxproj”在节点 2 上(Build 个目标)。 - 1>Link: + 1>ClCompile: + C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\CL.exe /c /I..\ /I.\GeneratedFiles /I. /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include /I.\GeneratedFiles\Debug /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include\QtCore /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include\QtGui /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include\QtWidgets /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include\QtNetwork /IC:\Qt\Qt5.8.0\5.8\msvc2013_64\include\QtSerialPort /Zi /nologo /W1 /WX- /Od /D UNICODE /D WIN32 /D WIN64 /D QT_DLL /D QT_CORE_LIB /D QT_GUI_LIB /D QT_WIDGETS_LIB /D QT_NETWORK_LIB /D QT_SERIALPORT_LIB /Gm- /EHsc /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Debug\\" /Fd"x64\Debug\vc120.pdb" /Gd /TP /errorReport:prompt GeneratedFiles\Debug\moc_testdll.cpp main.cpp testdll.cpp + moc_testdll.cpp + 1>D:\vspro\ProjectofIrisIMAGE\vincecontrol\vincecontrol\vincecontrol.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 + main.cpp + 1>D:\vspro\ProjectofIrisIMAGE\vincecontrol\vincecontrol\vincecontrol.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 + testdll.cpp + 1>D:\vspro\ProjectofIrisIMAGE\vincecontrol\vincecontrol\vincecontrol.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 + 正在生成代码... + Link: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"D:\vspro\ProjectofIrisIMAGE\vincecontrol\x64\Debug\\testdll.exe" /NOLOGO /LIBPATH:..\..\x64\Debug /LIBPATH:C:\Qt\Qt5.8.0\5.8\msvc2013_64\lib vincecontrol.lib qtmaind.lib Qt5Cored.lib Qt5Guid.lib Qt5Widgetsd.lib Qt5Networkd.lib Qt5SerialPortd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"D:\vspro\ProjectofIrisIMAGE\vincecontrol\x64\Debug\testdll.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:\vspro\ProjectofIrisIMAGE\vincecontrol\x64\Debug\testdll.lib" /MACHINE:X64 x64\Debug\moc_testdll.obj x64\Debug\qrc_testdll.obj x64\Debug\main.obj @@ -10,4 +19,4 @@ 生成成功。 -已用时间 00:00:00.73 +已用时间 00:00:09.61 diff --git a/testdll/x64/Debug/testdll.obj b/testdll/x64/Debug/testdll.obj index bea64f90c45ad8ab1bafe4c07e2391353fef48c5..4bd6671f890877b9af838aa2db5232fb2a396175 100644 GIT binary patch delta 55 zcmeyeLF&r}DfX1M|vNLXFX9|g7_F`a|-tWa^-##~n35c12m<5Pgx6h4X HyKW5tU_%td delta 55 zcmeyeLF&r}DfX1M?sa0>wtm(Fei9*0_x0k>L^0vwKZ4G>fS delta 27 jcmex&fal)v3yM;`5mNiV4h|T)-~?X4eV4ntVoR!sINLoXvGS GuUG(RjupfJ delta 21 dcmeyT_D^j?59eebrn=1vJaO!sKX8aK0RU!)2lM~{ diff --git a/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog b/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog index 5f8204d4b661f4e620d284d882a1ebf241f28c8d..2272d4063aef23f141bae4635ffe2afa73cbcbe5 100644 GIT binary patch delta 29 lcmX>Ve=2^1m&D|EtV)v)unBC=(~4o8yg+l#W-o~_K>)xr3zh%? delta 46 xcmX>Ve=2^1m&D{Z%6gLzunBCgk+5Rj{6_g6_hbRKkjV~OT9YrZIzVM&SOLW?5v%|J diff --git a/testdll/x64/Debug/testdll.tlog/link.read.1.tlog b/testdll/x64/Debug/testdll.tlog/link.read.1.tlog index c100a5a04233661d7f13c760dd09fc546e9dc1a0..d2f3b1ba1916ab8e74bcfe230323a25c6f95c42f 100644 GIT binary patch delta 106 zcmeyQvPgYH3jbs)A&be&1oJkZ;h(`cxrg6D+lj%G!H*$^A%ekz!HglE!I8n2!3D@N v0gCy6<-8g67+it!uA2=7ITn04j3=(m@PiFa->}3|tHVo^}>B delta 28 kcmZ3a{z+v+3jgFg0yUfE1X>s;I|yByyp2g#AwwmIXDPI&2>qwE-X;1vHPSIJh z29%H`>`}Ll%cf z#Oqc;JQoEe)VBz&d!cktI+SvSL)$Gw!O}v~ZxSbm&+o_k4d37U1@T%CuN`^z;AB71 z1|?eC#0_#2jpE~(ABKKLA1~`O?gyvVl+!wGYJWPf^=7fsEHX%e20Em{023^*;SOXV z3q8;a4!Cd^?m-{q;6C)j19%7nFbG4CSIr_%`S#XGiB;ZBy_^eePdru68@z0*m4AFg zKlT$ARk@$Gi0D(8_M}YzW<+1ruqSuTTJ^<<`fCcqvcF^6&Y10H%vShPs(vsw-xCGg zja)Gr#pu2$L=9fpE=Y^bDQvrTq8;I#1iY-NrFFiO-SqQYBKzpeYoc%G17uLErDJ!i zrJ)j)>#XCIL3FB0G5_p@XHg~>2KzbdeO@NcNrNwDy1(yc4PQJanp#Mac`IvinW*h8 xavSJWD=j=zZwhkH>74TmCnf4hRjeB9r`p>VCS!4U7>XfwrI;_rt;mz3{{dWyv9bUF diff --git a/vincecontrol.cpp b/vincecontrol.cpp index beeec67..948513d 100644 --- a/vincecontrol.cpp +++ b/vincecontrol.cpp @@ -11,10 +11,16 @@ VinceControl::VinceControl(ProTools proto) { protools = proto; initme(); + } +void VinceControl::setSyncMode() +{ + isSyncMotor = true; +} + VinceControl::~VinceControl() { if (protools == RS232 || protools == RS485) @@ -139,6 +145,10 @@ void VinceControl::SendCommandtoMotor(QString str) } else if (protools==NETTCP) { + if (isSyncMotor) + { + str = "0 " + str; + } if (tcpSocket.length() == 0) { return; @@ -160,6 +170,10 @@ void VinceControl::SendCommandtoMotor(QString str, QString modor) } + if (protools!=NETTCP) + { + return; + } int lenth = tcpSocket.length(); int lenthstring = Motorlist.length(); if (lenthstring!=lenth) @@ -170,6 +184,10 @@ void VinceControl::SendCommandtoMotor(QString str, QString modor) { if (Motorlist.at(i)==modor) { + if (isSyncMotor) + { + str = "0 " + str; + } tcpSocket[i]->write(str.toUtf8().data()); tcpSocket[i]->waitForBytesWritten(1000); return; @@ -372,6 +390,7 @@ void VinceControl::initme() RS485ID = "0"; Speednow = 0; SpeedisSet = false; + isSyncMotor = false; } diff --git a/vincecontrol.h b/vincecontrol.h index d0cf149..498fac9 100644 --- a/vincecontrol.h +++ b/vincecontrol.h @@ -102,6 +102,7 @@ public: // Parameter: int port //************************************ VinceControl(ProTools proto,int port); + ~VinceControl(); //************************************ // Method: MoveToLocation 移动到某位置(据0点) @@ -120,8 +121,18 @@ public: // Returns: void // Qualifier: //************************************ + void Handshacke(QString motorid = "non"); + //************************************ + // Method: setSyncMode 设置时间为双马达同步模式 + // FullName: VinceControl::setSyncMode + // Access: public + // Returns: void + // Qualifier: + //************************************ + void setSyncMode(); + //************************************ // Method: SettingZeroLocation 马达归零 // FullName: VinceControl::SettingZeroLocation @@ -305,6 +316,7 @@ private: void SettingSpeedByThis(long Speed, QString motornetid = "non"); ByteBack TranslateBytedata(QByteArray buf, QString motornetid = "non"); void initme(); + bool isSyncMotor; }; diff --git a/vincecontrol.vcxproj.user b/vincecontrol.vcxproj.user index 82c2f15..54c2122 100644 --- a/vincecontrol.vcxproj.user +++ b/vincecontrol.vcxproj.user @@ -1,12 +1,17 @@  - + + PATH="$(QTDIR)\bin%3b$(PATH) + C:\Qt\Qt5.8.0\5.8\msvc2013_64 - PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) + PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) C:\Qt\Qt5.8.0\5.8\msvc2013_64 - PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) + PATH=$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b"$(QTDIR)\bin%3b$(QTDIR)\bin%3b$(PATH) + + + PATH="$(QTDIR)\bin%3b$(PATH) \ No newline at end of file