更换通讯库版本
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
using JY.Inspection.Common;
|
||||
using HslCommunication;
|
||||
using HslCommunication.Core;
|
||||
using HslCommunication.Profinet.Omron;
|
||||
using JY.Inspection.Common;
|
||||
using JY.Model.Excel;
|
||||
using JY.Utility;
|
||||
using MetroFramework.Forms;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -77,7 +82,32 @@ namespace JY.Inspection.Frm
|
||||
|
||||
private void btn_testAlarm_Click(object sender, EventArgs e)
|
||||
{
|
||||
string address = "192.168.2.50";
|
||||
|
||||
OmronFinsNet omronFinsNet = new OmronFinsNet();
|
||||
omronFinsNet.IpAddress = address.ToString();
|
||||
omronFinsNet.Port = 9600;
|
||||
omronFinsNet.DA2 = 0;
|
||||
omronFinsNet.ByteTransform.DataFormat = DataFormat.CDAB;
|
||||
omronFinsNet.ByteTransform.IsStringReverseByteWord = true;
|
||||
omronFinsNet.ConnectTimeOut = 2000;
|
||||
omronFinsNet.ReceiveTimeOut = 2000;
|
||||
|
||||
var result = omronFinsNet.ConnectServer();
|
||||
|
||||
if (result != null && result.IsSuccess)
|
||||
{
|
||||
Debug.WriteLine("FinsTcp连接成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("FinsTcp连接失败");
|
||||
}
|
||||
|
||||
string addr = "D10010";
|
||||
ushort length = 150;
|
||||
byte[] byteResult = omronFinsNet.Read(addr, length).Content;
|
||||
OperateResult barray = omronFinsNet.ReadBool(addr, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user