Files
CheryFianlAssemblyLineNew/Analysis/Define/ConfigPlc.cs
T
HM-CN\zhengxuan.zhang 8cf3fb42d6 #总装移交版本
2025-03-07 11:44:37 +08:00

84 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**************************************************************************
*
* =================================
* CLR版本 4.0.30319.42000
* 命名空间 NSAnalysis.Define
* 文件名称 ConfigPlc.cs
* =================================
* 创 建 者 shupeng.wang
* 创建日期 2022/9/28 18:49:01
* 功能描述
* 使用说明
* =================================
* 修改者
* 修改日期
* 修改内容
* =================================
*
***************************************************************************/
using BaseFunction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NSAnalysis
{
/// <summary>
///
/// </summary>
public class ConfigPlc
{
private int m_WriteStartAddr = 0;
public int WriteStartAddr
{
get
{
return m_WriteStartAddr;
}
set
{
m_WriteStartAddr = value;
}
}
private int m_ReadStartAddr = 100;
public int ReadStartAddr
{
get
{
return m_ReadStartAddr;
}
set
{
m_ReadStartAddr = value;
}
}
/// <summary>
/// PLC通信协议: 1Modbus3S7
/// </summary>
public static int PlcType = 1;
public static string strIP = "192.168.1.30"; //PLC的IP地址 沈机:100
public static string strPort = "502"; //PLC的端口号
public static string strMac = "1"; //设备号
public static bool bReConnect = false;
public static bool bPositiveAequence = true;
public static void LoadConfig()
{
string strTemp = "TCP";
strIP = FileIni.ReadString(ConfigDfn.strConfigFile, strTemp, "ModbusTcp_IP");
strPort = FileIni.ReadString(ConfigDfn.strConfigFile, strTemp, "ModbusTcp_Port");
strMac = FileIni.ReadString(ConfigDfn.strConfigFile, strTemp, "ModbusTcp_Addr");
bReConnect = FileIni.ReadBool(ConfigDfn.strConfigFile, strTemp, "ModbusTcp_Reconnected", 1);
bPositiveAequence = !FileIni.ReadBool(ConfigDfn.strConfigFile, strTemp, "ModbusTcp_ReverseSequence", 1);
PlcType = FileIni.ReadInt(ConfigDfn.strConfigFile, strTemp, "PlcType", 1);
}
}
}