McProtocol 1.2.5

dotnet add package McProtocol --version 1.2.5                
NuGet\Install-Package McProtocol -Version 1.2.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="McProtocol" Version="1.2.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add McProtocol --version 1.2.5                
#r "nuget: McProtocol, 1.2.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install McProtocol as a Cake Addin
#addin nuget:?package=McProtocol&version=1.2.5

// Install McProtocol as a Cake Tool
#tool nuget:?package=McProtocol&version=1.2.5                

This package can be used to communicate with Mitsubishi PLCs. Currently there are 3 frames that are supported, MC1E, MC3E, and MC4E frames. To communicate with your Mitsubishi PLC refer to the owners manual to better understand if the McProtocol is supported by your PLC and what message frame your PLC calls for. In some cases the PLC may require a separate network card to support PC communication. Newer controllers are more likely to carry this protocol on the ethernet port on board. The benefit to this protocol is that you can use it in place of Modbus to eliminate the need for an expensive modus card. In addition to the McProtocol this library is designed to convert data from byte arrays to match the data types expected by the computer. My goal is to handle data conversion on in the library so that the user is not responsible for aligning bytes. Ultimately this will make the library easier to use. After you add the Nuget package to your project go ahead and add a using statement to begin using the library.

  using MCProtocol;

There are three steps to using this library. The first step is to set up the connection to the PLC using the IP address. The easiest way to do this is to store the connection in static field PLCData.PLC .

private async void ConnectToPlc()
{
       PLCData.PLC = new Mitsubishi.McProtocolTcp("192.168.1.4", 5012, Mitsubishi.McFrame.MC3E);
       await PLCData.PLC.Open();
}

Once the PLC connection is set up you can go ahead and make instances of the PLCData type. The class PLCData is ultimately a list type. When you create each list you will need to specify what device type the data is coming from, what the start address of the list of data is, and how long the list is.

 private PLCData<int> ints = new PLCData<int>(Mitsubishi.PlcDeviceType.D, 500, 6);

After the list is created you can read and write to the list by simply using the read and write methods.

private void WriteData()
{
      ints.WriteData();
 }
 private void ReadData()
 {
     ints.ReadData();
 }

Getting or setting items in the list can be done using the index operator since the type is ultimately just a list.

 ints[0] = 5;

The data is stored as a list of bytes and is converted to the matching data type when the data is set or retrieved. If data is not being read or written correctly it is possible that the data type specified for the list does not match the PLC's size and type. For example you may need to use a short instead of an int.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.5 43,599 7/26/2018
1.2.4 850 7/20/2018
1.2.3 954 7/19/2018
1.2.2 841 7/18/2018
1.2.1 911 7/18/2018
1.2.0 959 7/13/2018
1.1.1 896 6/29/2018
1.1.0 970 6/29/2018
1.0.0 1,179 2/5/2018