MachineInterfaceDll.dll新增IO口读写设置。
This commit is contained in:
@@ -4565,3 +4565,4 @@ Destruct Cso7_Proto.
|
||||
Exit: Exit_SO7Usb
|
||||
|
||||
Init:Open device succeed .
|
||||
|
||||
|
||||
+39
@@ -461,6 +461,45 @@ EXP_IMP SSI_STATUS_MOTION Illumination_SetLampState(double dTopLightPercent,doub
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================IO================================================
|
||||
EXP_IMP SSI_STATUS_MOTION Machine_GetDIO(EIO_PORT Channel,BYTE& bDISts)
|
||||
{
|
||||
if (!g_bOfflineOnly)
|
||||
{
|
||||
if (m_pSO7_Proto)
|
||||
{
|
||||
return m_pSO7_Proto->so7_GetDIO(static_cast<int>(Channel),bDISts);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
}
|
||||
EXP_IMP SSI_STATUS_MOTION Machine_SetDO(EIO_PORT Channel,BYTE bDOSts)
|
||||
{
|
||||
if (!g_bOfflineOnly)
|
||||
{
|
||||
if (m_pSO7_Proto)
|
||||
{
|
||||
return m_pSO7_Proto->so7_SetDO(static_cast<int>(Channel),bDOSts);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
}
|
||||
//==============================CMD================================================
|
||||
EXP_IMP SSI_STATUS_MOTION SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data)
|
||||
{
|
||||
if (!g_bOfflineOnly)
|
||||
|
||||
+10
@@ -29,6 +29,13 @@ enum EHOME_MACHINE_MODE
|
||||
HOME_R=30,
|
||||
HOME_TOATAL=255
|
||||
};
|
||||
enum EIO_PORT
|
||||
{
|
||||
INPORT_J2=0,//Effective bit:0-5
|
||||
OUTPORT_J1,//Effective bit:0-2
|
||||
OUTPORT_J3,//Effective bit:0-5
|
||||
LIMIT_SWITCH_J4//Effective bit:0-5
|
||||
};
|
||||
enum SSI_STATUS_MOTION
|
||||
{
|
||||
SSI_STATUS_MOTION_NORMAL = 0,
|
||||
@@ -71,6 +78,9 @@ extern "C"
|
||||
//==============================Illumination=======================================
|
||||
//Range value:0.0-100.0
|
||||
EXP_IMP SSI_STATUS_MOTION Illumination_SetLampState(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch);
|
||||
//==============================IO================================================
|
||||
EXP_IMP SSI_STATUS_MOTION Machine_GetDIO(EIO_PORT Channel,BYTE& bDISts);
|
||||
EXP_IMP SSI_STATUS_MOTION Machine_SetDO(EIO_PORT Channel,BYTE bDOSts);
|
||||
//==============================CMD================================================
|
||||
EXP_IMP SSI_STATUS_MOTION SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data);
|
||||
|
||||
|
||||
BIN
Binary file not shown.
+4
@@ -57,6 +57,10 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>..\..\..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Lib\Msvc\libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)\MachineInterfaceDll.dll" ..\Debug\MachineInterface\*.* /D /F /Y
|
||||
xcopy "$(OutDir)\MachineInterfaceDll.lib" ..\Debug\MachineInterface\*.* /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>
|
||||
</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommand>..\Debug\MachineInterface\HoleEdgeInspect.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -25,15 +25,6 @@
|
||||
#include "SO7_UtilDlg.h"
|
||||
// CSO7_UtilDlg 对话框
|
||||
|
||||
#define HBIT0 0X01
|
||||
#define HBIT1 0X02
|
||||
#define HBIT2 0X04
|
||||
#define HBIT3 0X08
|
||||
#define HBIT4 0X10
|
||||
#define HBIT5 0X20
|
||||
#define HBIT6 0X40
|
||||
#define HBIT7 0X80
|
||||
|
||||
extern CPSerial* m_pSO7_PCDSerial;
|
||||
extern CSO7_Proto* m_pSO7_Proto;
|
||||
extern CXBOXController* XBoxPlayer;
|
||||
|
||||
Binary file not shown.
@@ -11,102 +11,163 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
SSI_STATUS_MOTION status=Machine_Startup(false,HOME_NONE);
|
||||
printf("Machine_Startup:");
|
||||
ShowMessage(status);
|
||||
printf("Test Module[1-4]:");
|
||||
printf("\n");
|
||||
printf("1. Motion\n");
|
||||
printf("2. Illumination\n");
|
||||
printf("3. IO\n");
|
||||
printf("4. ALL\n");
|
||||
LONG TestModule(0);
|
||||
printf("Please Select Test Module[1-4]:");
|
||||
scanf_s("%d", &TestModule);
|
||||
|
||||
//=================================================================================
|
||||
//===============================Motion============================================
|
||||
bool bHomed(false);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
if (!bHomed)
|
||||
if (TestModule==1 || TestModule==4)
|
||||
{
|
||||
status=Motion_DCCHomeXYZ(HOME_XYZ);
|
||||
bool bHomed(false);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
do
|
||||
if (!bHomed)
|
||||
{
|
||||
Sleep(20);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
status=Motion_DCCHomeXYZ(HOME_XYZ);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
} while (!bHomed);
|
||||
}
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
do
|
||||
{
|
||||
Sleep(20);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
} while (!bHomed);
|
||||
}
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
status=Motion_Jog(MACHINE_AXIS_Y,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_Jog(MACHINE_AXIS_Y,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
status=Motion_Jog(MACHINE_AXIS_Z,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_Jog(MACHINE_AXIS_Z,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
double PositionX,PositionY,PositionZ;
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
PositionX=0.0;
|
||||
PositionY=0.0;
|
||||
PositionZ=0.0;
|
||||
printf("Motion_SetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
status=Motion_SetPositionXYZ(PositionX,PositionY,PositionZ,true);
|
||||
double PositionX,PositionY,PositionZ;
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
PositionX=0.0;
|
||||
PositionY=0.0;
|
||||
PositionZ=0.0;
|
||||
printf("Motion_SetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
status=Motion_SetPositionXYZ(PositionX,PositionY,PositionZ,true);
|
||||
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionY,PositionX,PositionZ);
|
||||
|
||||
//status=Motion_IsFinishedXYZ(bool &bFinished);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_SetSpeedXYZ(MACHINE_AXIS_X,3,20,20,20,3,0.01);
|
||||
printf("Motion_SetSpeedXYZ:");
|
||||
ShowMessage(status);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionY,PositionX,PositionZ);
|
||||
|
||||
//===================================Rotary Table==================================
|
||||
//Motion_DCCHomeR();
|
||||
//Motion_IsHomedR(bool &bHomed);
|
||||
////Units:Rad
|
||||
//Motion_GetPositionR(double& dPos);
|
||||
//Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
||||
//Motion_IsFinishedR(bool &bFinished);
|
||||
//==============================Illumination=======================================
|
||||
//Range value:0.0-100.0
|
||||
status=Illumination_SetLampState(0,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,0,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
//status=Motion_IsFinishedXYZ(bool &bFinished);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_SetSpeedXYZ(MACHINE_AXIS_X,3,20,20,20,3,0.01);
|
||||
printf("Motion_SetSpeedXYZ:");
|
||||
ShowMessage(status);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
//===================================Rotary Table==================================
|
||||
//Motion_DCCHomeR();
|
||||
//Motion_IsHomedR(bool &bHomed);
|
||||
////Units:Rad
|
||||
//Motion_GetPositionR(double& dPos);
|
||||
//Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
||||
//Motion_IsFinishedR(bool &bFinished);
|
||||
}
|
||||
if (TestModule==2 || TestModule==4)
|
||||
{
|
||||
//==============================Illumination=======================================
|
||||
//Range value:0.0-100.0
|
||||
status=Illumination_SetLampState(0,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,0,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
}
|
||||
//==============================IO================================================
|
||||
if (TestModule==3 || TestModule==4)
|
||||
{
|
||||
BYTE bDISts(0);
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(INPORT_J2,bDISts);
|
||||
printf("Machine_GetDIO:[INPORT_J2] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(LIMIT_SWITCH_J4,bDISts);
|
||||
printf("Machine_GetDIO:[LIMIT_SWITCH_J4] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
printf("Get limit switch status again. Press any key...\r\n");
|
||||
_getch();
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(LIMIT_SWITCH_J4,bDISts);
|
||||
printf("Machine_GetDIO:[LIMIT_SWITCH_J4] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(OUTPORT_J1,bDISts);
|
||||
printf("Machine_GetDIO:[OUTPORT_J1] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
bDISts=255;
|
||||
status=Machine_SetDO(OUTPORT_J1,bDISts);
|
||||
printf("Machine_SetDO:[OUTPORT_J1] 0XFF.--");
|
||||
ShowMessage(status);
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(OUTPORT_J1,bDISts);
|
||||
printf("Machine_GetDIO:[OUTPORT_J1] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(OUTPORT_J3,bDISts);
|
||||
printf("Machine_GetDIO:[OUTPORT_J3] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
bDISts=255;
|
||||
status=Machine_SetDO(OUTPORT_J3,bDISts);
|
||||
printf("Machine_SetDO:[OUTPORT_J3] 0XFF.--");
|
||||
ShowMessage(status);
|
||||
bDISts=0;
|
||||
status=Machine_GetDIO(OUTPORT_J3,bDISts);
|
||||
printf("Machine_GetDIO:[OUTPORT_J3] 0X%02X.--",bDISts);
|
||||
ShowMessage(status);
|
||||
}
|
||||
//==============================CMD================================================
|
||||
//SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data);
|
||||
status=Machine_Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user