Custom control of Siemens S7-1200

zoomable

Member
Join Date
Oct 2021
Location
Ontario
Posts
36
What is the simplest way to programmatically read/write PLC tags (in my case a Siemens S7-1200)? I am writing a custom software wedge that is to mediate between a CMM and PLC.
Thks,
z
 
If you enable Put/Get access in the S7-1200, then you can get easy access to "not optimized" datablock with many open source communication libraries for the S7-300/400 like Snap7 or libnodave.

The latest 1200 firmware versions support OPC UA access, but this needs to be licensed on the plc. Otherwise I'd say this should be the way to go in the future.

Another option is to enable the webserver on the S7, create a simple basic page with the variables you want to get access to, then you can read/write with http requests (write access after login). But the webserver is rather slow, if you want to read many values or get fast access.
 
Another option is to enable the webserver on the S7, create a simple basic page with the variables you want to get access to, then you can read/write with http requests (write access after login). But the webserver is rather slow, if you want to read many values or get fast access.


I think I saw that the 1500s support some kind of REST API, with JSON queries. Do the 1200's support that as well?
 
Thank you @Thomas_v2, my original plan is to use OPC-UA. It's giving me pause though, because it seems so indirect. I do like the security features it offers however.
 
Thank you @Thomas_v2, my original plan is to use OPC-UA. It's giving me pause though, because it seems so indirect. I do like the security features it offers however.


With the 1200/1500, the OPC UA server can be directly in the PLC, so it isn't nearly as indirect as OPC traditionally has been.
 
I think I saw that the 1500s support some kind of REST API, with JSON queries. Do the 1200's support that as well?

The documentation says "yes", but I haven't tested it. But you can create a fake JSON api even with older firmware versions by creating a custom .json page in JSON format, where you insert the values with the AWP syntax like:

Code:
<!-- AWP_In_Variable Name='TestInt1' -->
<!-- AWP_In_Variable Name='TestInt2' -->
[
    {
        "name": "TestInt1",
        "value": :=TestInt1:
    },
    {
        "name": "TestInt2",
        "value": :=TestInt2:
    }
]
As mk42 said, the OPC-UA server runs directly on the S7-1200 Plc, you can connect your OPC-UA client directly to the plc without any middleware. The license cost is about 50 € if im remember correctly. In percentage for the cost of the 1200 it's much if you have a low specced one, but for a 1500 it's not.
 

Similar Topics

Greetings experts, I'm attempting to create a custom LED control in TwinCAT HMI, and for the life of me I cannot get the thing to resize after I...
Replies
0
Views
1,161
Good day! I am working on a project at our campus to integrate fleet vehicle chargers with load management so we don't overwhelm our service. The...
Replies
37
Views
3,783
I imported a customised shape into the project, but I don't know how to actually add into on to a specific HMI screen. Do I use the Graphics menu...
Replies
2
Views
654
I'm testing the ability to make a custom ActiveX control for PVP7 applications to be able to write data out in an XML format. With my simple...
Replies
0
Views
642
I am having difficulty finding documentation or examples on integrating Visual Studio with iX Developer in order to develop custom objects...
Replies
0
Views
535
Back
Top Bottom