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 849dd69..4312841 100644 Binary files a/testdll/x64/Debug/main.obj and b/testdll/x64/Debug/main.obj differ diff --git a/testdll/x64/Debug/moc_testdll.obj b/testdll/x64/Debug/moc_testdll.obj index d396aca..88277c9 100644 Binary files a/testdll/x64/Debug/moc_testdll.obj and b/testdll/x64/Debug/moc_testdll.obj differ diff --git a/testdll/x64/Debug/testdll.log b/testdll/x64/Debug/testdll.log index 0bec2b6..a98a315 100644 --- a/testdll/x64/Debug/testdll.log +++ b/testdll/x64/Debug/testdll.log @@ -1,6 +1,15 @@ -生成启动时间为 2020/9/3 14:49:21。 +生成启动时间为 2020/9/4 16:50:37。 1>项目“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 bea64f9..4bd6671 100644 Binary files a/testdll/x64/Debug/testdll.obj and b/testdll/x64/Debug/testdll.obj differ diff --git a/testdll/x64/Debug/testdll.tlog/CL.read.1.tlog b/testdll/x64/Debug/testdll.tlog/CL.read.1.tlog index eb1e468..3da331c 100644 Binary files a/testdll/x64/Debug/testdll.tlog/CL.read.1.tlog and b/testdll/x64/Debug/testdll.tlog/CL.read.1.tlog differ diff --git a/testdll/x64/Debug/testdll.tlog/CL.write.1.tlog b/testdll/x64/Debug/testdll.tlog/CL.write.1.tlog index c653c3b..88bab84 100644 Binary files a/testdll/x64/Debug/testdll.tlog/CL.write.1.tlog and b/testdll/x64/Debug/testdll.tlog/CL.write.1.tlog differ diff --git a/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog b/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog index 5f8204d..2272d40 100644 Binary files a/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog and b/testdll/x64/Debug/testdll.tlog/cl.command.1.tlog differ diff --git a/testdll/x64/Debug/testdll.tlog/link.read.1.tlog b/testdll/x64/Debug/testdll.tlog/link.read.1.tlog index c100a5a..d2f3b1b 100644 Binary files a/testdll/x64/Debug/testdll.tlog/link.read.1.tlog and b/testdll/x64/Debug/testdll.tlog/link.read.1.tlog differ diff --git a/testdll/x64/Debug/vc120.pdb b/testdll/x64/Debug/vc120.pdb index 9a59a14..8801115 100644 Binary files a/testdll/x64/Debug/vc120.pdb and b/testdll/x64/Debug/vc120.pdb differ 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