Commit cae06c13 刘韬

兼容x64

1 个父辈 a4fa1854
...@@ -35,10 +35,13 @@ namespace PUSICANLibrary ...@@ -35,10 +35,13 @@ namespace PUSICANLibrary
byte[] data, DATA_TYPE datatype, uint sendlen, uint timeout); byte[] data, DATA_TYPE datatype, uint sendlen, uint timeout);
[DllImport("CanOpen.dll", EntryPoint = "PUSICO_SetDriver", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] [DllImport("CanOpen.dll", EntryPoint = "PUSICO_SetDriver", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern PUSIResult PUSICO_SetDriver(string dllname, out IntPtr lib); public static extern PUSIResult PUSICO_SetDriver(string dllname, out IntPtr lib);
#if x86
[DllImport("CanOpen.dll", EntryPoint = "PUSICO_Open", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] [DllImport("CanOpen.dll", EntryPoint = "PUSICO_Open", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern PUSIResult PUSICO_Open(string busname, string buadrate); public static extern PUSIResult PUSICO_Open(string busname, string buadrate);
#else
[DllImport("CanOpen.dll", EntryPoint = "PUSICO_Open", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern PUSIResult PUSICO_Open(string busname, string buadrate, int nBufferTimer, int nBufferSize);
#endif
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
public extern static IntPtr GetProcAddress(IntPtr lib, string funcName); public extern static IntPtr GetProcAddress(IntPtr lib, string funcName);
...@@ -46,11 +49,11 @@ namespace PUSICANLibrary ...@@ -46,11 +49,11 @@ namespace PUSICANLibrary
public static extern PUSIResult PUSICO_SetNodeState(uint nodeid, SLAVE_MANAGEMENT slaveManagement); public static extern PUSIResult PUSICO_SetNodeState(uint nodeid, SLAVE_MANAGEMENT slaveManagement);
#endregion #endregion
private static Dictionary<uint, Dictionary<uint, int>> sdoLastData = new Dictionary<uint, Dictionary<uint, int>>(); private static Dictionary<uint, Dictionary<uint, int>> sdoLastData = new Dictionary<uint, Dictionary<uint, int>>();
#region 读写SDO #region 读写SDO
private static void UpdateSDOData(uint nodeId, uint addr, int value) private static void UpdateSDOData(uint nodeId, uint addr, int value)
{ {
...@@ -148,7 +151,7 @@ namespace PUSICANLibrary ...@@ -148,7 +151,7 @@ namespace PUSICANLibrary
return result; return result;
} }
#endregion #endregion
public static int SleepMS= 30; public static int SleepMS= 30;
public delegate void SetTcpClient_drvier(string ip, int nPort); public delegate void SetTcpClient_drvier(string ip, int nPort);
...@@ -232,7 +235,11 @@ namespace PUSICANLibrary ...@@ -232,7 +235,11 @@ namespace PUSICANLibrary
ISOpen = false; ISOpen = false;
return "加载驱动失败!"; return "加载驱动失败!";
} }
#if x86
if (PUSIResult.RET_SUCCESS == PUSICANControl.PUSICO_Open(busname, baudlist[baudIndex])) if (PUSIResult.RET_SUCCESS == PUSICANControl.PUSICO_Open(busname, baudlist[baudIndex]))
#else
if (PUSIResult.RET_SUCCESS == PUSICANControl.PUSICO_Open(busname, baudlist[baudIndex],5,100))
#endif
{ {
ISOpen = true; ISOpen = true;
Console.WriteLine("打开端口成功."); Console.WriteLine("打开端口成功.");
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>TRACE;DEBUG;x86</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -635,6 +635,9 @@ ...@@ -635,6 +635,9 @@
</Target> </Target>
<Import Project="..\packages\Microsoft.ML.0.11.0\build\netstandard2.0\Microsoft.ML.targets" Condition="Exists('..\packages\Microsoft.ML.0.11.0\build\netstandard2.0\Microsoft.ML.targets')" /> <Import Project="..\packages\Microsoft.ML.0.11.0\build\netstandard2.0\Microsoft.ML.targets" Condition="Exists('..\packages\Microsoft.ML.0.11.0\build\netstandard2.0\Microsoft.ML.targets')" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" /> <Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<PropertyGroup>
<PostBuildEvent>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86\editbin" /largeaddressaware "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!