Recently, I needed to access tags on a Siemens S7-300 PLC in Ignition 7.9 for one of my projects. These tags were communicated using an intermediate Siemens SIMATIC NET OPC Server. Since I know Ignition’s documentation is usually quite stellar, I consulted their guide to help configure my OPC tags.
I confirmed my OPC connection was good, then I configured my tags as described in the documentation...and I got a configuration error.
This error was strange considering I had other tags already reading properly over this OPC server. So, I scoured the internet for an explanation of why this occurred. All of the forums I read through, however, pointed to the same Ignition documentation I mentioned earlier for how to correctly address these tags.
If I couldn’t find the solution online, then I would find the solution myself—one of DMC’s core values is “Make Things Happen,” after all. After experimenting, I eventually discovered that syntax was the problem. With a few adjustments, the following format yielded correct addresses for reading the OPC tags within Ignition:
ns=3;s={ConnectionName}.{MemoryArea}.{Offset},{Type}
Component
|
Description
|
{ConnectionName}
|
The connection name, specific to the PLC (can be found by browsing the OPC server).
|
{MemoryArea}
|
The memory area where the desired tag is located. Examples include:
- Inputs – I
- Datablocks – DB{n}
- Outputs – Q
|
{Offset}
|
The numerical offset within the memory area
|
{Type}
|
The tag data type. Examples include:
- Real – R
- Double Word – DW
- I - Integer
- C – character
- X{n} – bit {n} of the word specified in {Offset}
|
Examples
The following are some examples I found in this project that illustrate this format:
- Bit 1 at offset 164 in Inputs:
- Double word at offset 42 in datablock 947:
ns=3;s=S7 connection LA2141.DB947.42,DW
- Real at offset 12 in datablock 2701:
ns=3;s=S7 connection LF4431.DB2701.12,R
- Character at offset 92 in datablock 945 (interestingly this came across as the ASCII code for the character, which I then had to use a script to convert into an actual character):
ns=3;s=S7 connection LA2141.DB945.92,C
These are the example areas/data types I came across while working with this system and they should work for other areas/data types. If you’ve run into other examples, please let us know in the comments below and let’s share some knowledge!
Learn more about DMC’s Ignition expertise and contact us to get started on your next project.