解决C#调用DLL托管于非托管匹配的问题。
This commit is contained in:
@@ -12,11 +12,55 @@ namespace ConsoleTestDll
|
||||
MACHINEINTERFACEDLL.SSI_STATUS_MOTION rStatus;
|
||||
Console.WriteLine("Machine_Startup.");
|
||||
rStatus = MACHINEINTERFACEDLL.Machine_Startup(false, MACHINEINTERFACEDLL.EHOME_MACHINE_MODE.HOME_XYZ);
|
||||
Console.WriteLine("RStatus:{0}\n",rStatus);
|
||||
Console.WriteLine("RStatus:{0}\n", rStatus);
|
||||
Byte bDISts = 0;
|
||||
Console.WriteLine("Machine_GetDIO.");
|
||||
rStatus = MACHINEINTERFACEDLL.Machine_GetDIO(MACHINEINTERFACEDLL.EIO_PORT.LIMIT_SWITCH_J4, ref bDISts);
|
||||
Console.WriteLine("RStatus:{0}\n", rStatus);
|
||||
bool IOStatus = false;
|
||||
int iComp1 = 1;
|
||||
int iComp2 = 0;
|
||||
int i = 0;
|
||||
Console.WriteLine("IOStatus:");
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
iComp2=iComp1 << i;
|
||||
if ((bDISts & iComp2) == iComp2)
|
||||
{
|
||||
IOStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOStatus = false;
|
||||
}
|
||||
Console.WriteLine("{0} ", IOStatus);
|
||||
}
|
||||
|
||||
Console.WriteLine("Wait...");
|
||||
Console.ReadLine();
|
||||
Console.WriteLine("Machine_GetDIO.");
|
||||
bDISts = 0;
|
||||
rStatus = MACHINEINTERFACEDLL.Machine_GetDIO(MACHINEINTERFACEDLL.EIO_PORT.LIMIT_SWITCH_J4, ref bDISts);
|
||||
Console.WriteLine("RStatus:{0}\n", rStatus);
|
||||
i = 0;
|
||||
Console.WriteLine("IOStatus:");
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
iComp2 = iComp1 << i;
|
||||
if ((bDISts & iComp2) == iComp2)
|
||||
{
|
||||
IOStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOStatus = false;
|
||||
}
|
||||
Console.WriteLine("{0} ", IOStatus);
|
||||
}
|
||||
Console.WriteLine("Machine_Shutdown");
|
||||
rStatus = MACHINEINTERFACEDLL.Machine_Shutdown();
|
||||
Console.WriteLine("RStatus:{0}\n", rStatus, ".\n");
|
||||
Console.WriteLine("Press enter key to exit...");
|
||||
Console.WriteLine("RStatus:{0}\n", rStatus);
|
||||
Console.WriteLine("Press enter key to exit...");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user