MachineInterfaceDll.dll新增IO口读写设置。
This commit is contained in:
@@ -382,7 +382,7 @@ BOOL CART_PCI8622::GetData(double (*_Data)[HALF_SIZE_WORDS],int* _DataNumber)
|
||||
{
|
||||
ADData = ((ADBuffer[m_SegmentID][Index]));
|
||||
// 将原码转换为电压值
|
||||
dVolt = static_cast<double>(((m_AD_LSB_MAX/m_AD_LSB_RANGE) * ADData - m_AD_LSB_HALF));
|
||||
dVolt = static_cast<double>(((m_AD_LSB_MAX/m_AD_LSB_RANGE) * (ADData&0xFFFF) - m_AD_LSB_HALF));
|
||||
_Data[nADChannel][_DataNumber[nADChannel]]=dVolt;
|
||||
_DataNumber[nADChannel]+=1;
|
||||
nADChannel++;
|
||||
|
||||
@@ -5,6 +5,22 @@
|
||||
#include "math.h"
|
||||
|
||||
|
||||
#define HBIT0 0X0001
|
||||
#define HBIT1 0X0002
|
||||
#define HBIT2 0X0004
|
||||
#define HBIT3 0X0008
|
||||
#define HBIT4 0X0010
|
||||
#define HBIT5 0X0020
|
||||
#define HBIT6 0X0040
|
||||
#define HBIT7 0X0080
|
||||
#define HBIT8 0X0100
|
||||
#define HBIT9 0X0200
|
||||
#define HBIT10 0X0400
|
||||
#define HBIT11 0X0800
|
||||
#define HBIT12 0X1000
|
||||
#define HBIT13 0X2000
|
||||
#define HBIT14 0X4000
|
||||
#define HBIT15 0X8000
|
||||
#define MAX_IN_BUFF_SIZE 1024
|
||||
|
||||
//***** Static Data *****
|
||||
|
||||
@@ -23,22 +23,6 @@ using namespace INTEGMOTORINTERFACELib;
|
||||
#define THREAD_RUNNING_STATE 0
|
||||
#define THREAD_PAUSED 1
|
||||
#define THREAD_EXIT -1
|
||||
#define HBIT0 0X0001
|
||||
#define HBIT1 0X0002
|
||||
#define HBIT2 0X0004
|
||||
#define HBIT3 0X0008
|
||||
#define HBIT4 0X0010
|
||||
#define HBIT5 0X0020
|
||||
#define HBIT6 0X0040
|
||||
#define HBIT7 0X0080
|
||||
#define HBIT8 0X0100
|
||||
#define HBIT9 0X0200
|
||||
#define HBIT10 0X0400
|
||||
#define HBIT11 0X0800
|
||||
#define HBIT12 0X1000
|
||||
#define HBIT13 0X2000
|
||||
#define HBIT14 0X4000
|
||||
#define HBIT15 0X8000
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
|
||||
@@ -4271,6 +4271,179 @@ SSI_STATUS_MOTION CSO7_Proto::so7_light_set_lamp_state(double dTopLightPercent,d
|
||||
};
|
||||
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_GetDIO(int Channel,BYTE& bDISts)
|
||||
{
|
||||
char Addr(0);
|
||||
switch(Channel)
|
||||
{
|
||||
case INPORT_J2:
|
||||
{
|
||||
Addr=ESO7_CONTROLLER_INPUT_PORT_ADDR;
|
||||
break;
|
||||
}
|
||||
case OUTPORT_J1:
|
||||
{
|
||||
Addr=ESO7_CONTROLLER_WOUTPUT_PORT_ADDR;
|
||||
break;
|
||||
}
|
||||
case OUTPORT_J3:
|
||||
{
|
||||
Addr=ESO7_CONTROLLER_OUTPUT_PORT_ADDR;
|
||||
break;
|
||||
}
|
||||
case LIMIT_SWITCH_J4:
|
||||
{
|
||||
Addr=ESO7_CONTROLLER_LIMIT_SWITCH_ADDR;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Addr=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Addr>=0)
|
||||
{
|
||||
_send_cmd_SO7_CMD_READ_INPUT_PORT_STATUS(Addr);
|
||||
bDISts=static_cast<BYTE>(g_machine.InPortStatus);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
bDISts=0;
|
||||
return SSI_STATUS_MOTION_INVALID_PARAMETERS;
|
||||
}
|
||||
}
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_SetDO(int Channel,BYTE bDOSts)
|
||||
{
|
||||
char cSetIOStatusAddr(0);
|
||||
char cSetValue(0);
|
||||
switch(Channel)
|
||||
{
|
||||
case OUTPORT_J1:
|
||||
{
|
||||
if (bDOSts&HBIT0)
|
||||
{
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_M_LASE_ON,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_M_LASE_OFF,0);
|
||||
}
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT1)
|
||||
{
|
||||
cSetIOStatusAddr=1;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=1;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT2)
|
||||
{
|
||||
cSetIOStatusAddr=2;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=2;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
break;
|
||||
}
|
||||
case OUTPORT_J3:
|
||||
{
|
||||
if (bDOSts&HBIT0)
|
||||
{
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_M_PROBE_OFF,0);
|
||||
Sleep(5);
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_LASE_TIMMER_ON,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_M_PROBE_ON,0);
|
||||
Sleep(5);
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND(CT_MOTOR,CT_LASE_TIMMER_OFF,0);
|
||||
}
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT1)
|
||||
{
|
||||
cSetIOStatusAddr=11;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=11;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT2)
|
||||
{
|
||||
cSetIOStatusAddr=12;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=12;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT3)
|
||||
{
|
||||
cSetIOStatusAddr=13;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=13;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT4)
|
||||
{
|
||||
cSetIOStatusAddr=14;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=14;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
if (bDOSts&HBIT5)
|
||||
{
|
||||
cSetIOStatusAddr=15;
|
||||
cSetValue=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cSetIOStatusAddr=15;
|
||||
cSetValue=0;
|
||||
}
|
||||
_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(CT_DATA,CT_WRITE_IO_DAT,cSetIOStatusAddr,cSetValue);
|
||||
Sleep(5);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//********************************************************************************//
|
||||
//*******************************************************************************//
|
||||
|
||||
@@ -4287,7 +4460,10 @@ SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_MOVE_X(char SpeedGear)
|
||||
*(ep_buff[EP_02_CMD_IDX]._buffer+2) = SpeedGear;
|
||||
|
||||
TRACE1("[MOVE_X]:%d\n",static_cast<int>(SpeedGear));
|
||||
|
||||
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(_T("Jog X:%d.\n"),SpeedGear);
|
||||
}
|
||||
ep_buff[EP_02_CMD_IDX]._size = 0x03;
|
||||
ep_buff[EP_81_DATA_IDX]._size = 0x03;
|
||||
|
||||
@@ -4308,7 +4484,10 @@ SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_MOVE_Y(char SpeedGear)
|
||||
*(ep_buff[EP_02_CMD_IDX]._buffer+2) = SpeedGear;
|
||||
|
||||
TRACE1("[MOVE_Y]:%d\n",static_cast<int>(SpeedGear));
|
||||
|
||||
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(_T("Jog Y:%d.\n"),SpeedGear);
|
||||
}
|
||||
ep_buff[EP_02_CMD_IDX]._size = 0x03;
|
||||
ep_buff[EP_81_DATA_IDX]._size = 0x03;
|
||||
|
||||
@@ -4329,7 +4508,10 @@ SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_MOVE_Z(char SpeedGear)
|
||||
*(ep_buff[EP_02_CMD_IDX]._buffer+2) = SpeedGear;
|
||||
|
||||
TRACE1("[MOVE_Z]:%d\n",static_cast<int>(SpeedGear));
|
||||
|
||||
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(_T("Jog Z:%d.\n"),SpeedGear);
|
||||
}
|
||||
ep_buff[EP_02_CMD_IDX]._size = 0x03;
|
||||
ep_buff[EP_81_DATA_IDX]._size = 0x03;
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@
|
||||
#define EIGHT_SEGS 8
|
||||
#define FIVE_RINGS 5
|
||||
|
||||
#define HBIT0 0X01
|
||||
#define HBIT1 0X02
|
||||
#define HBIT2 0X04
|
||||
#define HBIT3 0X08
|
||||
#define HBIT4 0X10
|
||||
#define HBIT5 0X20
|
||||
#define HBIT6 0X40
|
||||
#define HBIT7 0X80
|
||||
|
||||
const long MAX_INTENSITY = 0x3FF;
|
||||
#define MAXLIGHTVALUE 255
|
||||
#define MINLIGHTVALUE 1
|
||||
@@ -453,6 +462,9 @@ public:
|
||||
SSI_STATUS_MOTION so7_light_set_light();
|
||||
SSI_STATUS_MOTION so7_light_set_lamp_state(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch);
|
||||
|
||||
SSI_STATUS_MOTION so7_GetDIO(int Channel,BYTE& bDISts);
|
||||
SSI_STATUS_MOTION so7_SetDO(int Channel,BYTE bDOSts);
|
||||
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_X(char SpeedGear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_Y(char SpeedGear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_Z(char SpeedGear);
|
||||
|
||||
@@ -4565,3 +4565,4 @@ Destruct Cso7_Proto.
|
||||
Usb Port Initialized.
|
||||
Usb Port Initialized.
|
||||
Usb Port Initialized.
|
||||
Usb Port Initialized.
|
||||
|
||||
+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