Skip to content

Commit

Permalink
v2.48
Browse files Browse the repository at this point in the history
- Fix issue FC01 in RTU mode causes "Internal Error"
- Fix timeout FC02 RTU
- Fix timeout and CRC error warning FC06 RTU
- Added right click template datagrids
- Improved check response FC05/FC15/FC06/FC16
  • Loading branch information
fedeturco committed Sep 24, 2024
1 parent 0dba0e0 commit 31ef2ac
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
17 changes: 11 additions & 6 deletions ModBus_Client/ModBus_Chicco.cs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ public UInt16[] readInputStatus_02(byte slave_add, uint start_add, uint no_of_in
if (response.Length == 0)
{
Console_print(" Timed out", null, 0);
return null;
throw new ModbusException("Timed out");
}

RX_set = true; // pictureBox gialla
Expand Down Expand Up @@ -1855,7 +1855,7 @@ public UInt16[] readInputRegister_04(byte slave_add, uint start_add, uint no_of_
if (response.Length == 0)
{
Console_print(" Timed out", null, 0);
return null;
throw new ModbusException("Timed out");
}

RX_set = true; // pictureBox gialla
Expand All @@ -1864,7 +1864,7 @@ public UInt16[] readInputRegister_04(byte slave_add, uint start_add, uint no_of_
Console_print(" Rx <- ", response, response.Length);

// Check CRC
if(!Check_CRC(response, response.Length))
if (!Check_CRC(response, response.Length))
{
throw new ModbusException("CRC Error");
}
Expand Down Expand Up @@ -2100,7 +2100,11 @@ public String diagnostics_08(byte slave_add, uint sub_func, uint data, int readT
Console.WriteLine("Timeout lettura porta seriale");
}

Check_CRC(response, Length);
// Check CRC
if (!Check_CRC(response, Length))
{
throw new ModbusException("CRC Error");
}

// Timeout
if (Length == 0)
Expand Down Expand Up @@ -2713,9 +2717,10 @@ public UInt16[] presetMultipleRegisters_16(byte slave_add, uint start_add, UInt1
Console_printByte("Rx: ", response, response.Length);
Console_print(" Rx <- ", response, response.Length);

if(!Check_CRC(response, response.Length))
// Check CRC
if (!Check_CRC(response, response.Length))
{
return new UInt16[0] { };
throw new ModbusException("CRC Error");
}

// Modbus Error Code
Expand Down
28 changes: 24 additions & 4 deletions ModBus_Client/ModBus_Client.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2542,10 +2542,20 @@ public void writeMultipleCoils()
{
SetTableCrcError(list_coilsTable, true);
}

this.Dispatcher.Invoke((Action)delegate
{
buttonWriteCoils15.IsEnabled = true;
});
}
else
{
SetTableInternalError(list_coilsTable, true);

this.Dispatcher.Invoke((Action)delegate
{
buttonWriteCoils15.IsEnabled = true;
});
}

this.Dispatcher.Invoke((Action)delegate
Expand Down Expand Up @@ -2692,6 +2702,8 @@ public void readInputs()
}
else
{
SetTableInternalError(list_inputsTable, true);

this.Dispatcher.Invoke((Action)delegate
{
buttonReadInput02.IsEnabled = true;
Expand Down Expand Up @@ -3573,8 +3585,12 @@ public void writeMultipleRegisters()
else
{
MessageBox.Show(lang.languageTemplate["strings"]["errSetReg"], "Alert");
list_holdingRegistersTable[(int)(address_start)].Foreground = ForeGroundLight.ToString();
list_holdingRegistersTable[(int)(address_start)].Background = Brushes.Red.ToString();

this.Dispatcher.Invoke((Action)delegate
{
list_holdingRegistersTable[(int)(address_start)].Foreground = ForeGroundLight.ToString();
list_holdingRegistersTable[(int)(address_start)].Background = Brushes.Red.ToString();
});
}
}
}
Expand Down Expand Up @@ -3613,8 +3629,12 @@ public void writeMultipleRegisters()
else
{
MessageBox.Show(lang.languageTemplate["strings"]["errSetReg"], "Alert");
list_holdingRegistersTable[(int)(address_start)].Foreground = ForeGroundLight.ToString();
list_holdingRegistersTable[(int)(address_start)].Background = Brushes.Red.ToString();

this.Dispatcher.Invoke((Action)delegate
{
list_holdingRegistersTable[(int)(address_start)].Foreground = ForeGroundLight.ToString();
list_holdingRegistersTable[(int)(address_start)].Background = Brushes.Red.ToString();
});
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ModBus_Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.47.*")]
[assembly: AssemblyVersion("2.48.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Client ModBus TCP/RTU written in C# useful for Modbus read and write operations

## Release

### v2.47 New Version
[ModBus_Client_v2.47 - Portable Zip](https://github.com/fedeturco/ModBus_Client/releases/download/2.47/ModBus_Client_v2.47.zip)
### v2.48 New Version
[ModBus_Client_v2.48 - Portable Zip](https://github.com/fedeturco/ModBus_Client/releases/download/2.48/ModBus_Client_v2.48.zip)

### v2.46 Stable
[ModBus_Client_v2.46 - Portable Zip](https://github.com/fedeturco/ModBus_Client/releases/download/2.46/ModBus_Client_v2.46.zip)
### v2.47 Stable
[ModBus_Client_v2.47 - Portable Zip](https://github.com/fedeturco/ModBus_Client/releases/download/2.47/ModBus_Client_v2.47.zip)

### Manual
[Manual EN](https://github.com/fedeturco/ModBus_Client/blob/master/ModBus_Client/Manuals/ModBus_Client_EN.pdf)
Expand Down

0 comments on commit 31ef2ac

Please sign in to comment.