Offered AS IS.
Not recommended for production use of any sort.
Designed for Windows and intended as a quick testing tool (it also runs in Mono, see replies #7 and #8).
The attached pictures might differ from current design (see pictures in reply #6 for the latest design and the link to the latest app).
It requires that the plctag.dll file be either in the folder with the app itself or somewhere where the OS normally looks for files.
The easiest thing to do is run the app from the Debug folder or place a shortcut on the desktop.
Reply #6 offers a slightly different approach by embedding the libraries into the exe file.
The app is using libplctag library and modified C# Wrapper by Mesta Automation, here is where you can find more info about them:
-
https://github.com/kyle-github/libplctag , licensed under LGPL license (
https://www.gnu.org/licenses/lgpl-3.0.en.html )
-
https://github.com/mesta1/libplctag-csharp, licensed under MIT license (
http://opensource.org/licenses/mit-license.php )
Both licenses by the authors can be found in the "License" folder of this project.
Packet delay code for even reads was adopted from AdvancedHMI drivers.
Useful Info:
https://www.mesta-automation.com/how-to-communicate-to-an-allen-bradley-plc-with-c-and-libplctag-ethernet-ip-library/Tips for using this app with SLC (as tested with MicroLogix 1100 PLC):
1) Timer / Counter / Control data types are currently set to work for reading from SLC with the following format and its variants:
T4:0.PRE, Timer, 1 C5:0.ACC, Counter, 1 R6:0.POS, Control, 1
T4:0.TT, Timer, 1 C5:0.CU, Counter, 1 R6:0.LEN, Control, 1
T4:0.EN, Timer, 1 C5:0.CD, Counter, 1 R6:0.EU, Control, 1
Polling either of Timer / Counter / Control without sub-element specified will show 3 x 16-bit values for either.
If you really need to write then use Int16 as a Data Type instead, for example the tag would be "T4:0.PRE; Int16; 1".2) Each Read/Write transaction Is limited to 236 bytes of data (for example, you can read up to 2 strings of 84 bytes each).
3) Bit count starts at 0 (ex. N7:0/0) and character count starts at 1 (ex. ST9:0/1). This is applicable to all PLCs.
4) An experimental support for 128-bit values (Int128 and Uint128) was also included, so you can read/write them with addressing like this: N7:0; Int128; 1
Tips for ControlLogix PLC:
1) You can get the list of Controller & Program tags with the newly added button and combobox. Program tags will be listed without "Program:MainRoutine." prefix, which you will still need to use in order to Read/Write to these tags.
2) For Timer/Counter/Control in Logix PLCs you should use addressing similar to this:
Controller_Tag_Counter_1.PRE, DINT, 1 Controller_Tag_Timer_1.PRE, DINT, 1
Controller_Tag_Counter_1.ACC, DINT, 1 Controller_Tag_Timer_1.ACC, DINT, 1
Controller_Tag_Counter_1.CU, BOOL, 1 Controller_Tag_Timer_1.EN, BOOL, 1
Controller_Tag_Counter_1.CD, BOOL, 1 Controller_Tag_Timer_1.TT, BOOL, 1
Controller_Tag_Counter_1.DN, BOOL, 1 Controller_Tag_Timer_1.DN, BOOL, 1
This approach might work a bit faster than when using address like this: Controller_Tag_Timer_1.PRE, Timer, 1
3) Even UDT elements can be accessed individually for as long as you know the type, these would be examples from this topic
https://www.advancedhmi.com/forum/index.php?topic=2545.0 :
Orders_Pool[0].ID, DINT, 1
Orders_Pool[0].Name, String, 1
Orders_Pool[0].Plan_QTY, DINT, 1
Orders_Pool[0].Time_Est, DINT, 1
4) The latest library version provides packet size negotiation so there is no hard limit as with SLC.
The app will rely on your knowledge of data types and tags in your PLC as well as the correct path to your device.
The attached pictures show the example of addressing, which is in the format of: Tag + Data Type + Element Count.
Arrays [x,y] and [x,y,z] are supported as well with the addressing format of: Tag + Data Type + Element Count + X + Y + Z.
Reply #6 has the link to the latest app which eliminated the need for " + X + Y + Z" part as well as some other fixes. The attached pictures in this post also show an error caused by selecting an incorrect Data Type and typing an incorrect tag.
Also attached is the full solution.
For either of Bit/Character/BOOLArray/Array operations, the Element Count will represent the number of consecutive bits/characters/array elements.
You can Read/Write bits just by using a slash ("/") in the tag, like this:
- "Controller_Tag_DINT/5, DINT, 6" <-- request to read 6 consecutive bits starting at bit 5 (for Logix PLCs)
- "B3:0/0; Int16, 1" <-- request to read bit 0 (for SLC PLCs)
This would be true for tags that do allow writing otherwise it's Read only.
AdvancedHMI is still a far better choice of AB Master application.
No PLC5 features have been tested since I don't have access to that PLC (so everything defaults to SLC).
Auto mode is for reading only but will still allow the manual Read/Write operations that use the "Send" button.
Alternative choice is to have 2 separate instances of the app, one for AutoRead and one to perform writes. These should be run from separate folders and each using its own plctag.dll library.
There might be issues that I didn't notice. Do bother reporting any issues you might encounter.
The project is set to target x86 platform.
Tested as working on both 32-bit and 64-bit Windows computer.
IMPORTANTWhen using any of the solutions from this topic, then make sure that it is set for x86 platform when you open it.
If it is set to "AnyCPU" or "x64" then see the reply #7 on how to obtain already compiled x64 library.
There is also an Android version of this project:
https://github.com/GitHubDragonFly/TabletTest