- Modbus 12열에서도 사용 가능하도록 수정

master
DESKTOP-999R8N3\CJY 2025-04-08 14:43:12 +09:00
parent 8b672498e8
commit 8e616c73d0
5 changed files with 75 additions and 65 deletions

Binary file not shown.

View File

@ -282,8 +282,7 @@ namespace INT_LKD_2.Controls
{
if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 1)
{
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
this.groupBoxModbusSetting.Visible = true;
this.labelModbusRole.Text = "Slave";
@ -294,8 +293,7 @@ namespace INT_LKD_2.Controls
}
else if (this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE == 2)
{
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(true);
this.groupBoxModbusSetting.Visible = true;
this.labelModbusRole.Text = "Master";
@ -307,20 +305,17 @@ namespace INT_LKD_2.Controls
}
else
{
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
this.groupBoxModbusSetting.Visible = false;
}
}
else
{
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainButtonModbusAdd(false);
this.groupBoxModbusSetting.Visible = false;
}
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.InitialEthernetIcon();
this.ParentForm.ParentForm.ChildFormMainDisplay.InitialEthernetIcon();
}
public void DisplayRefresh()
@ -461,7 +456,6 @@ namespace INT_LKD_2.Controls
this.ParentForm.ParentForm.EthernetClientDisconnect();
afterOpMode = "Client";
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
this.labelConnectedIP.Text = "-";
@ -479,7 +473,6 @@ namespace INT_LKD_2.Controls
this.ParentForm.ParentForm.SystemConfig.ETHERNET_OP_MODE = 0;
afterOpMode = "None";
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
this.buttonStartServer.Enabled = false;
@ -602,8 +595,7 @@ namespace INT_LKD_2.Controls
if (this.timerServer.Enabled != false)
this.timerServer.Enabled = false;
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
}
else
{
@ -612,8 +604,7 @@ namespace INT_LKD_2.Controls
if (this.timerServer.Enabled != true)
this.timerServer.Enabled = true;
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(true);
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(true);
}
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStart, "Server");
@ -626,8 +617,7 @@ namespace INT_LKD_2.Controls
if (this.labelServerStatus.Text != ">Stop")
this.labelServerStatus.Text = ">Stop";
if (this.ParentForm.ParentForm.SystemConfig.EQUIPMENT_LANE == 10)
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
this.ParentForm.ParentForm.ChildFormMainDisplay.TimerServer(false);
this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.TryEthernetStop, "Server");
}
private void buttonSaveServer_Click(object sender, EventArgs e)

View File

@ -33,6 +33,10 @@ namespace INT_LKD_2
public const int _18_9_IsLeak = 3027;
public const int _19_10_IsProcessing = 3028;
public const int _20_10_IsLeak = 3029;
public const int _21_11_IsProcessing = 3030;
public const int _22_11_IsLeak = 3031;
public const int _23_12_IsProcessing = 3032;
public const int _24_12_IsLeak = 3033;
}
public class _30000_ModbusData
{
@ -77,19 +81,19 @@ namespace INT_LKD_2
public void Initialization()
{
this.CollectionIsProcessing = new Collection<short>();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsProcessing.Add(0);
this.CollectionIsLeak = new Collection<short>();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsLeak.Add(0);
this.CollectionIsProcessingHexa = new Collection<string>();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsProcessingHexa.Add(this.CollectionIsProcessing[i].ToString("X8"));
this.CollectionIsLeakHexa = new Collection<string>();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsLeakHexa.Add(this.CollectionIsLeak[i].ToString("X8"));
}
@ -97,12 +101,12 @@ namespace INT_LKD_2
{
if(this.CollectionIsProcessingHexa.Count > 0)
this.CollectionIsProcessingHexa.Clear();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsProcessingHexa.Add(this.CollectionIsProcessing[i].ToString("X8"));
if (this.CollectionIsLeakHexa.Count > 0)
this.CollectionIsLeakHexa.Clear();
for (int i = 0; i < 10; i++)
for (int i = 0; i < 12; i++)
this.CollectionIsLeakHexa.Add(this.CollectionIsLeak[i].ToString("X8"));
}
#endregion

View File

@ -264,43 +264,40 @@ namespace INT_LKD_2.Forms
}
private void DefaultSetting2()
{
if (this.SystemConfig.EQUIPMENT_LANE == 10)
// 이더넷
if (this.SystemConfig.ETHERNET_OP_MODE == 1)
{
// 이더넷
if (this.SystemConfig.ETHERNET_OP_MODE == 1)
try
{
try
{
if (string.Compare(this.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") != 0)
this.EthernetServerStart();
if (string.Compare(this.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") != 0)
this.EthernetServerStart();
this.ChildFormMainDisplay.TimerServer(true);
}
catch
{
}
this.ChildFormMainDisplay.TimerServer(true);
}
else if (this.SystemConfig.ETHERNET_OP_MODE == 2)
catch
{
this.EthernetClientDisconnect();
}
if (this.SystemConfig.ETHERNET_COMM_MODE != (int)Define.E_CommMode.f0_None)
{
switch (this.SystemConfig.ETHERNET_COMM_MODE)
{
case (int)Define.E_CommMode.f1_Modbus:
this.ChildFormMainDisplay.MainButtonModbusAdd(true);
break;
default:
break;
}
}
this.ChildFormMainDisplay.InitialEthernetIcon();
}
}
else if (this.SystemConfig.ETHERNET_OP_MODE == 2)
{
this.EthernetClientDisconnect();
}
if (this.SystemConfig.ETHERNET_COMM_MODE != (int)Define.E_CommMode.f0_None)
{
switch (this.SystemConfig.ETHERNET_COMM_MODE)
{
case (int)Define.E_CommMode.f1_Modbus:
this.ChildFormMainDisplay.MainButtonModbusAdd(true);
break;
default:
break;
}
}
this.ChildFormMainDisplay.InitialEthernetIcon();
}
private void InitializeUserManager()
{
UserManager.UserListNewDataEvent += this.UserManager_UserListNewDataEvent;
@ -4209,6 +4206,26 @@ namespace INT_LKD_2.Forms
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._21_11_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[10]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._22_11_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[10]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._23_12_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[11]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._24_12_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[11]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
default:
break;
#endregion
@ -4271,12 +4288,10 @@ namespace INT_LKD_2.Forms
default:
break;
}
this.Current30000ModbusData.CollectionIsLeak[i] = (short)this.CurrentLeakDatas[i].Judgment.Result;
}
if (this.SystemConfig.EQUIPMENT_LANE == 10)
this.ChildFormMainDisplay.ChildModbus.UpdateData(this.Current30000ModbusData);
this.ChildFormMainDisplay.ChildModbus.UpdateData(this.Current30000ModbusData);
//this.DelegateModbusStatus();
// 로그
@ -4484,8 +4499,7 @@ namespace INT_LKD_2.Forms
private void UIServerStatus(bool status)
{
if (this.SystemConfig.EQUIPMENT_LANE == 10)
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status);
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status);
}
public void DelegateUISeverStatus(bool status)
{
@ -5900,8 +5914,7 @@ namespace INT_LKD_2.Forms
#region Modbus TCP
if (this.smartTCPMultiServer.ClientInfoList != null)
{
if (this.SystemConfig.EQUIPMENT_LANE == 10)
this.ChildFormMainDisplay.ChildModbus.UpdateReceiveCount();
this.ChildFormMainDisplay.ChildModbus.UpdateReceiveCount();
//Console.Write("\n" + string.Format("Receive Modbus {0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, Helper.ByteToHexString(readByte)));

View File

@ -45,23 +45,23 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="InModbus, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="InModbus, Version=2.0.8.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Release\InModbus.dll</HintPath>
<HintPath>C:\Program Files (x86)\Intech\InModbus_V2.0.9.1\InModbus.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsCE.Forms" />
<Reference Include="mscorlib" />
<Reference Include="SmartXNCommon, Version=5.0.0.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\SmartX_New_5.0.0.6_IEC1000_DOTNETCF3.5수동설치파일\SmartXNCommon.dll</HintPath>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\IEC1000\SmartXNCommon.dll</HintPath>
</Reference>
<Reference Include="SmartXNFDCommon, Version=5.0.0.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\SmartX_New_5.0.0.6_IEC1000_DOTNETCF3.5수동설치파일\SmartXNFDCommon.dll</HintPath>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\IEC1000\SmartXNFDCommon.dll</HintPath>
</Reference>
<Reference Include="SmartXN_IEC1000, Version=5.0.0.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\SmartX_New_5.0.0.6_IEC1000_DOTNETCF3.5수동설치파일\SmartXN_IEC1000.dll</HintPath>
<HintPath>C:\Program Files (x86)\HNS\Embedded SmartX Component\V5.0.0.6_20221115\IEC1000\SmartXN_IEC1000.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -421,6 +421,9 @@
<Compile Include="SerialManager\SerialManager.Define.cs" />
<Compile Include="SerialManager\SerialManager.Structure.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Version.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>