增加了关于双步进电机同步运行
This commit is contained in:
@ -21,3 +21,7 @@
|
||||
新加内容
|
||||
|
||||
5、设置加减速度 SettingUpandDownSpeed(int addspeed, int downspeed)
|
||||
|
||||
2020-9-10:
|
||||
增加了关于双步进电机同步运行 函数如下:
|
||||
void setSyncMode(); 调用该函数后 改类就变成双步进电机了(nettcp+RS485协议)
|
@ -3,10 +3,10 @@
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QTDIR>C:\Qt\Qt5.8.0\5.8\msvc2013_64</QTDIR>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QTDIR>C:\Qt\Qt5.8.0\5.8\msvc2013_64</QTDIR>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
||||
};
|
||||
|
@ -1,12 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerEnvironment>PATH="$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QTDIR>C:\Qt\Qt5.8.0\5.8\msvc2013_64</QTDIR>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QTDIR>C:\Qt\Qt5.8.0\5.8\msvc2013_64</QTDIR>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
<LocalDebuggerEnvironment>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)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerEnvironment>PATH="$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user