1、合并master与2021.1

This commit is contained in:
xiejunjie
2021-12-03 11:25:35 +08:00
parent dc07b8879b
commit 4bd7d1b80b
981 changed files with 384342 additions and 6470 deletions
@@ -61,6 +61,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="RS232.cs" />
<Compile Include="MachineInterfaceDll.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -8,6 +8,29 @@ namespace ConsoleTestDll
class Program
{
static void Main(string[] args)
{
Test_RS232();
}
static void Test_RS232()
{
IntPtr hwnd = (IntPtr)0;
Console.WriteLine("init_rs232.");
var rStatus = RS232_API.init_rs232(hwnd, 1, 2400);
Console.WriteLine("RStatus:{0}", rStatus);
Console.WriteLine("Press any key to next step...");
Console.ReadLine();
byte[] buf = { 3, 1, 13 };
Console.WriteLine("Led:Green");
RS232_API.Write_Com(buf, 3);
Console.WriteLine("Press any key to next step...");
Console.ReadLine();
buf[1] = 2;
Console.WriteLine("Led:Red");
RS232_API.Write_Com(buf, 3);
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
}
static void Test_MachineInterface()
{
MACHINEINTERFACEDLL.SSI_STATUS_MOTION rStatus;
Console.WriteLine("Machine_Startup.");
@@ -24,7 +47,7 @@ namespace ConsoleTestDll
Console.WriteLine("IOStatus:");
for (i = 0; i < 6; i++)
{
iComp2=iComp1 << i;
iComp2 = iComp1 << i;
if ((bDISts & iComp2) == iComp2)
{
IOStatus = true;
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Sys
{
public partial class RS232_API
{
[DllImport("RS232_DLL.dll", EntryPoint = "init_rs232",
SetLastError = true, CharSet = CharSet.Unicode,
ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool init_rs232(IntPtr hwnd, UInt16 com_type, UInt16 baud);
[DllImport("RS232_DLL.dll", EntryPoint = "Write_Com",
SetLastError = true, CharSet = CharSet.Unicode,
ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void Write_Com(byte[] Str, int len);
}
}