<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Function Blocks Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/function-blocks/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Thu, 09 Jul 2026 18:35:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>Function Blocks Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Sending Emails with a Siemens 1200 PLC</title>
		<link>https://static.dmcinfo.com/blog/19834/sending-emails-with-a-siemens-1200-plc/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Wed, 24 Jun 2020 14:32:51 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[How To]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/19834/sending-emails-with-a-siemens-1200-plc/</guid>

					<description><![CDATA[<p>If you have not checked out our previous blog on sending emails with a Siemens 1500 PLC, be sure to read that before reading this addition. We know how difficult it can be to do something as simple as sending an email from a PLC, especially when considering all the different issues that can arise. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/19834/sending-emails-with-a-siemens-1200-plc/">Sending Emails with a Siemens 1200 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">If you have not checked out our previous blog on <a href="/latest-thinking/blog/id/9936/sending-emails-with-a-siemens-1500-plc">sending emails with a Siemens 1500 PLC</a>, be sure to read that before reading this addition.</p>

<p class="wp-block-paragraph">We know how difficult it can be to do something as simple as sending an email from a PLC, especially when considering all the different issues that can arise. If you are having trouble sending emails, do not give up. This blog is going to fill you in on what you can do with a Siemens 1200 PLC for sending emails, and hopefully give you insight into additional troubleshooting techniques for getting them working correctly.</p>

<p class="wp-block-paragraph">Starting from the beginning, let&rsquo;s make sure that you have everything set up accordingly.</p>

<h2 class="wp-block-heading">Hardware</h2>

<p class="wp-block-paragraph">When using a PLC to send out emails you must know what type of emails you are sending out. If you are sending emails through a secure protocol (SSL or TLS), then you are going to need additional hardware for either the S7 1500 or the S7 1200 Siemens PLCs.</p>

<p class="wp-block-paragraph">These secure protocols typically communicate using ports 465, and 587. Port 465 if you are using SSL, and port 587 if you are using TLS. For the PLC to communicate through either of these ports, then you will need the addition of a communications processing module. This is typically done when trying to send emails through a public SMTP server like Gmail, or Yahoo.</p>

<p class="wp-block-paragraph">If you are looking to send emails to a local SMTP server, then you can use port 25 for SMTP relay and you do not need an additional communications processing module. Note, this must be done behind a firewall because most firewalls block any traffic on port 25. The configuration for sending emails using port 25 can be more difficult, due to the lower security protocols.</p>

<p class="wp-block-paragraph">For our example, we sent emails to a Gmail account and used a <strong>CP1243-1 communications processor (CP)</strong> with an <strong>S7 1214c PLC</strong>. The CP1243-1 can be configured to any of the S7 1200 PLCs. These are configured as follows.</p>

<p class="wp-block-paragraph">Connect the CP module to the PLC via the terminals on the side of the PLC. There is no need to connect them to each other through their ethernet ports as they can communicate through their back-plane connection. Connect the CP module to the router/modem via a short ethernet cable. Finally, connect the computer that is being used to access the PLC through one of the ports available on the PLC, and it should all be good to go.</p>

<h2 class="wp-block-heading">Hardware Troubleshooting</h2>

<p class="wp-block-paragraph">Verify that the CP module and the PLC are set up in the TIA portal with the same version that matches the physical hardware. Without doing this the CP module and PLC will not compile correctly. Typical troubleshooting for this is straight forward, and there are many different online resources available to help.</p>

<h2 class="wp-block-heading">Software</h2>

<p class="wp-block-paragraph">Refer to the previous blog (<a href="/latest-thinking/blog/id/9936/sending-emails-with-a-siemens-1500-plc">Sending Emails with a Siemens 1500 PLC</a>) for information on how to set up the TMAIL_C function block, Gmail application settings, obtain trusted certifications, and enable security clearance.</p>

<p class="wp-block-paragraph">The entire process is the same for setting up an S7 1500 PLC and an S7 1200 PLC except for the address parameter input.</p>

<p class="wp-block-paragraph">For the address parameters in the TMAIL_C function block, you will be using a <strong>TMAIL_QDN_SEC</strong> system data type instead of the <strong>TMAIL_V4_SEC</strong> system data type. The QDN stands for Qualified Domain Name, which allows you to use domain name servers instead of IP addresses. The settings for the <strong>Address_Parameters</strong> can be set up as seen below.</p>

<p class="wp-block-paragraph">It is important to note that sometimes the <strong>TMail_QDN_SEC</strong> will not autofill as you type out the data type. Typically, if you type it&nbsp;correctly, all the additional parameters will appear after pressing the enter key.</p>

<p class="wp-block-paragraph">One thing that may differ is the <strong>TLSServerCertRef</strong>. The <strong>TLSServerCertRef</strong> refers to the index at which your encryption certification resides and can be changed accordingly. In our example, we had our encryption certification in index 4.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/1-address-parameters.png"  /></figure>

<h2 class="wp-block-heading">Troubleshooting</h2>

<p class="wp-block-paragraph"><u><strong>Status Codes</strong></u></p>

<p class="wp-block-paragraph">Be sure to latch any of the status codes you have for diagnostic purposes. Here is an example of how we latched our statuses and sent them to another variable for diagnostics purposes.</p>

<p class="wp-block-paragraph"><figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/2-local-alarm.png"  /></figure><br />
<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/3-local-alarm-2.png"  /></figure></p>

<p class="wp-block-paragraph"><u><strong>Error Code #8420</strong></u></p>

<p class="wp-block-paragraph">When trying to send an email with a PLC you may get the error code #8420 (SMTP error code 420). This is a timeout connection error which typically results in there being a problem with the firewall, an issue with the PLC and CP modules onboard time, or an issue with the router or modem.</p>

<p class="wp-block-paragraph"><u><strong>Time Synchronization</strong></u></p>

<p class="wp-block-paragraph">Be sure that the time on both the CP module and the PLC are up to date. Without doing this you will likely get a timeout error. To change the time of your PLC and CP module you need to first go online with the PLC and CP module. Once online with the PLC and CP module, go to the <strong>Online and Diagnostics settings</strong> for each device. First, check that the time is in sync for the PLC, the CP module uses the PLC to update its time.</p>

<p class="wp-block-paragraph">For the PLC, go to <strong>Online and Diagnostics&gt;Functions&gt; Set time</strong>. Select the checkbox for &ldquo;Take from PG/PC&rdquo; and then hit apply. From here you can check the time on your CP module and see if it synced up or not.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/4-set-time.png"  /></figure>

<p class="wp-block-paragraph">To access the time for the CP module, go to the online and diagnostics for the CP module located at the bottom of the project tree under local modules. As you can see below, the time on the CP module did not sync up accordingly. This is common when setting the time for the first time on the PLC and will require a full power cycle of the PLC and CP while connected.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/5-time-communication.png"  /></figure>

<p class="wp-block-paragraph">Be sure to select&nbsp;<strong>&ldquo;Enable time-of-day synchronization&rdquo;</strong> if it has not already been selected for the CP module.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/6-time-of-day-sync.png"  /></figure>

<p class="wp-block-paragraph">Afterward, the CP modules time should update with a full power cycle if the CP module and PLC remain connected upon booting up.</p>

<p class="wp-block-paragraph"><u><strong>Router/Modem Configuration</strong></u></p>

<p class="wp-block-paragraph">Be sure to look through the router and modem configuration settings. Most of the time you will be able to connect to the router/modem via ethernet and access the settings by typing in the gateway IP in your web browser. Try other web browsers if the first one does not work. Verify that the IP address of the gateway in the PLC properties is consistent with that of your gateway. If your computer is on the same network as the PLC, you can determine what the IP address of your router/modem is by doing an IP configuration in your command prompt.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/7-IP-config.png"  /></figure>

<p class="wp-block-paragraph">Command prompt command <strong>ipconfig</strong> will pull up all the connections associated with your computer.</p>

<p class="wp-block-paragraph">This is an example of a default gateway that you are trying to search for in IP configuration. It is common for this IP address to be configured as 192.168.1.1, especially if the PLC you are using is operating with its own router/modem.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/8-default-gateway.png"  /></figure>

<p class="wp-block-paragraph">In our example, the gateway that my computer was using was different than the gateway of the PLC. Be sure to troubleshoot the settings in the appropriate gateway. Below is an example of accessing the settings to our router/modem.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/9-browser-IP.png"  /></figure>

<p class="wp-block-paragraph">Be sure that there are no limitations on the trusted IP or edit the limitations to allow for the IP address of your CP module. As seen here, outbound port filtering settings can be configured to limit the access of your PLC from sending emails effectively.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/10-outbound-ips.png"  /></figure>

<p class="wp-block-paragraph"><u><strong>DNS Configuration</strong></u></p>

<p class="wp-block-paragraph">Sometimes your DNS configuration may be the cause of a potential error. Especially if you are trying to use the qualified domain name for your emailing server. A typical fix for this could be to switch your DNS server to the basic google DNS server. In the CP modules, general properties adjust the DNS configuration as follows.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/11-DNS-config.png"  /></figure>

<p class="wp-block-paragraph"><u><strong>Device Configuration</strong></u></p>

<p class="wp-block-paragraph">Your device configuration needs to match your physical hardware. Double-check all the firmware as well as model numbers on every device such that they match the physical hardware. You can check this by going online with the PLC and going to <strong>Online Diagnostics&gt; Diagnostics&gt; General&gt; Firmware</strong>.</p>

<p class="wp-block-paragraph">Once you verify the version of the PLC or CP module are different you can change them accordingly in the Device View by right-clicking the PLC/CP module and selecting Change Device.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/12-device-confit.png"  /></figure>

<p class="wp-block-paragraph"><u><strong>Error Code #8530</strong></u></p>

<p class="wp-block-paragraph">Error code #8530 (SMTP error code 530) typically indicates an authentication problem. Solutions to this error code typically involve your Address Parameters. Verify that these are correct to your specific setup. Make sure you acquired the correct encryption certificate.</p>

<p class="wp-block-paragraph">Also, verify that the Email Configuration settings for the CP module match the settings in the <strong>TMAIL_C function block</strong>. These settings can be found in the<strong> Device Configuration&gt; Properties&gt; General&gt; E-mail Configuration</strong>.</p>

<figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/13-email-config.png"  /></figure>

<p class="wp-block-paragraph">Lastly, check your Gmail/email server settings. Sometimes whenever you think you have done everything correctly; you will get one last error. Be sure to check your email account settings. You will likely get a notification asking for verification about suspicious activity on your account. If you got this notification, then you should be one step away from success.</p>

<p class="wp-block-paragraph"><figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/14-google-alert.png"  /></figure><figure class="wp-block-image"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/15-google-block.png"  /></figure></p>

<p class="wp-block-paragraph">&nbsp;</p>

<h2 class="wp-block-heading">Status Code #7002</h2>

<p class="wp-block-paragraph">This is not an error, you did it! Today is a glorious day! It is time to celebrate! You successfully sent an email with a PLC and a CP module. People told you that it couldn&rsquo;t be done but you proved them wrong. Time to kick back and enjoy this moment.</p>

<p class="wp-block-paragraph"><strong>Learn more about DMC&apos;s <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming">PLC Programming expertise</a> and <a href="/contact">contact us</a> with project inquiries or questions.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/19834/sending-emails-with-a-siemens-1200-plc/">Sending Emails with a Siemens 1200 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Sending Emails with a Siemens 1500 PLC</title>
		<link>https://static.dmcinfo.com/blog/21143/sending-emails-with-a-siemens-1500-plc/</link>
		
		<dc:creator><![CDATA[Blake Strebel]]></dc:creator>
		<pubDate>Tue, 13 Aug 2019 13:25:13 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[TIA Portal]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21143/sending-emails-with-a-siemens-1500-plc/</guid>

					<description><![CDATA[<p>Out of the box, Siemens 1500 PLCs can send emails through a third-party email service provider. This interface supplies a mechanism for alerting relevant personal of faults, warnings, and other status information. The following guide outlines the steps required for establishing a secure connection to an email server and using the TMAIL_C function block to [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21143/sending-emails-with-a-siemens-1500-plc/">Sending Emails with a Siemens 1500 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Out of the box, <a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens 1500 PLCs</a> can send emails through a third-party email service provider. This interface supplies a mechanism for alerting relevant personal of faults, warnings, and other status information.</p>



<p class="wp-block-paragraph">The following guide outlines the steps required for establishing a secure connection to an email server and using the <strong>TMAIL_C function block</strong> to send messages.</p>



<p class="wp-block-paragraph">This configuration requires a 1500 PLC with minimum firmware V2.0. If you are using a PLC which does not meet these requirements, you may need an additional communication module to establish a connection to the server. These steps also assume that your PLC is connected to the internet via a router.</p>



<p class="wp-block-paragraph">The basic tasks are outlined below:</p>



<ul class="wp-block-list">
<li>Configure email server</li>



<li>Obtain encryption certificate</li>



<li>Import certificate into TIA Portal</li>



<li>Update the PLC hardware configuration</li>



<li>Configure the TMAIL_C function block</li>



<li>Use the TMAIL_C function block</li>
</ul>



<p class="wp-block-paragraph">I used TIA Portal V15.1 for this walkthrough. The procedure may differ slightly for different versions.</p>



<h2 class="wp-block-heading" id="h-configuring-email-server">Configuring Email Server</h2>



<p class="wp-block-paragraph">For this example, we created a dedicated Gmail account to act as an email server. This server communicates with the PLC via <strong>Simple Mail Transfer Protocol</strong> (SMTP) and transmits emails to the final recipient. For most providers, the default settings will need to be changed to enable the sending of messages via an external program. If you&#8217;re using a Gmail account, turn off two-step verification and enable less secure app access in your account settings. Without this access, the PLC connection to the server will be rejected.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/configuring-email-server.png" alt="configure email server"/></figure>



<h2 class="wp-block-heading" id="h-obtaining-encryption-certificate">Obtaining Encryption Certificate</h2>



<p class="wp-block-paragraph">The Transport Layer Security (TLS) protocol is used to encrypt the SMTP communications between the PLC client and the email server to ensure a secure connection. Consequently, the PLC needs the certificate associated with the email service provider to sign and encrypt messages.</p>



<p class="wp-block-paragraph">In Internet Explorer, the name of the relevant certificate can be obtained by navigating to your service providers webpage and opening the security report. When I created this walkthrough, Gmail used the Google Trusted Services – GlobalSign Root CA-R2 certificate.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/encryption-certificate.png" alt="plc encryption certificate"/></figure>



<p class="wp-block-paragraph">After determining the correct name, locate the certificate in your computer&#8217;s certificate manager and export it as a <strong>*.cer file</strong> in the DER encoded binary format. In the next step, we will import this certificate into <a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming/">TIA Portal</a> before adding it to the PLC hardware configuration. This allows the PLC to communicate with the email server using the additional security provided by the TLS protocol.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/export-tasks.png" alt="exporting tasks"/></figure>



<h2 class="wp-block-heading" id="h-importing-certificate-into-tia-portal">Importing Certificate into TIA Portal</h2>



<p class="wp-block-paragraph">After configuring the email server and obtaining the correct certification file, the remaining configuration is performed in TIA Portal. First, a project administrator must be specified, providing access to the additional security features of the project. These features allow us to add a third&nbsp;party certificate to the project.</p>



<p class="wp-block-paragraph">To create an administrator, navigate to the security settings for the project and define the necessary credentials. Note, these credentials will be required to access the project in the future.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/project-administrator.png" alt="project admin"/></figure>



<p class="wp-block-paragraph">After defining a security administrator, the security settings of the project should include additional security features, including the certificate manager. To import the certificate file, navigate to the certificate authority, and right-click to import the file. After importing, the certificate containing the public key required for the SMTP connection should appear in the manager.</p>



<p class="wp-block-paragraph">Note the expiration date of the certificate, as it may need updating in the future. Furthermore, ensure that the PLC time is set correctly, as the factory default may fall outside of the certificate’s valid range.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/import-certificate.png" alt="importing certificcate"/></figure>



<h2 class="wp-block-heading" id="h-updating-plc-hardware-configuration">Updating PLC Hardware Configuration</h2>



<p class="wp-block-paragraph">After importing the certificate into the project, the hardware configuration of the PLC must be updated to establish a connection to the email server. This process involves adding the certificate to the device and configuring the DNS server settings.</p>



<p class="wp-block-paragraph">First, navigate to the <strong>certificate manager</strong> in the Protection &amp; Security settings of the device configuration. Enable the use of the global security settings to provide full functionality. Then, add the certificate as a partner device. Note that if the certificate manager settings tab does not appear, then your hardware likely does not support this configuration. In this case, you may need to use an external communication module to use the TMAIL_C function block.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/certificate-manager.png" alt="certificate manager"/></figure>



<p class="wp-block-paragraph">After adding the certificate to the hardware configuration, we need to verify the DNS server settings of the PLC. A <strong>Domain Name System</strong> (DNS) server is required to associate domain names with the IP addresses needed for routing information between the PLC and the email server.</p>



<p class="wp-block-paragraph">For this application, the router connecting the PLC to the internet will act as the DNS server. Consequently, the router address must match the DNS server address in the hardware configuration. After verifying the router address in the PLC’s PROFINET interface, navigate to the DNS configuration and add it to the list of DNS server addresses.</p>



<p class="wp-block-paragraph">If you are unsure the proper address, you can use the<strong> ipconfig </strong>command on a PC networked to the PLC to determine the default gateway of your local network.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="h-configuring-the-tmail-c-function-block">Configuring the TMAIL_C Function Block</h2>



<p class="wp-block-paragraph">After the hardware configuration for the PLC is complete, the final task involves setting up the TMAIL_C function block to send messages. This block can be found under <strong>Communication</strong> in the <strong>Instruction Window</strong>.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/tmail-c.png" alt="tmail_C"/></figure>



<p class="wp-block-paragraph">The <strong>MAIL_ADDR_PARAM</strong> input is used to define the connection details. For an S7-1500 CPU, the TMail_V4_SEC system data type should be used to establish a secure connection using <strong>IPv4</strong>. Note, Siemens provides several additional data types for communicating with a server using different protocols.</p>



<p class="wp-block-paragraph">The parameters of the TMail_V4_SEC data type need to be defined as follows:</p>



<ul class="wp-block-list">
<li style="margin-bottom:20px;"><strong>InterfaceId:</strong> The hardware identifier of the PROFINET interface being used to communicate with the email server. This value is found in the system constants list located in the device configuration.<br />
 

<figure class="wp-block-image"><img decoding="async" alt="local profinet interface" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/local-profinet-interface.png"  /></figure>

</li>



<li style="margin-bottom:20px;"><strong>ID:</strong> The connection identifier. This value should likely be 1.</li>



<li style="margin-bottom:20px;"><strong>ConnectionType:</strong> Defines the connection type. Use 16#20 for IPv4.</li>



<li style="margin-bottom:20px;"><strong>ActiveEstablished:</strong> Defines if connections are actively or passively established. Since the PLC is acting as the SMTP client, it must actively establish a connection to communicate with the server. Therefore, this value must be true.</li>



<li style="margin-bottom:20px;"><strong>WatchDogTime:</strong> The duration before a communication timeout occurs</li>



<li style="margin-bottom:20px;"><strong>MailServerAddress: </strong>The IP address of the configured email server. Pinging the SMTP server from any PC determines this value.<br />
 

<figure class="wp-block-image"><img decoding="async" alt="mail server addresses" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/mail-server-address.png"  /></figure>

</li>



<li style="margin-bottom:20px;"><strong>UserName:</strong> The username for your email server account</li>



<li style="margin-bottom:20px;"><strong>PassWord:</strong> The password for your email server account. Note, the PLC instance memory will store this password in plain text.</li>



<li style="margin-bottom:20px;"><strong>From:</strong>
 

<ul class="wp-block-list">
  

<li style="margin-bottom:20px;"><strong>LocalPartPlusAt: </strong>The local part of your email address plus the &quot;@&quot; symbol. For a Gmail account, this will be your username followed by &quot;@.&quot;</li>


  

<li style="margin-bottom:20px;"><strong>FullQualifiedDomainName: </strong>The domain name of your email service provider. For example, &quot;gmail.com.&quot;</li>


 </ul>


 </li>



<li style="margin-bottom:20px;"><strong>Remote Port: </strong>This is the remote TCP port used for the connection. The default port for SMTP communications is 587. Some legacy systems may use alternative ports, but they are generally less secure and not recommended.</li>



<li style="margin-bottom:20px;"><strong>ActivateSecureConn:</strong> This value should be true to activate the security functionality of the connection. If it is false, a non-secure connection will be established which may be rejected by the server.</li>



<li style="margin-bottom:20px;"><strong>ExtTLSCapabilities:</strong> Allows for extended capabilities of the TLS handshaking protocol. This is not required for this configuration.</li>



<li style="margin-bottom:20px;"><strong>TLSServerCertRef:</strong> Reference to the encryption certificate of the email server. Use the integer ID of the imported certificate.</li>
</ul>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/address-parameters.png" alt="address parameters"/></figure>



<h2 class="wp-block-heading" id="h-using-the-tmail-c-function-block">Using the TMAIL_C Function Block</h2>



<p class="wp-block-paragraph">After configuring the address parameters, using the TMAIL_C block is relatively straightforward. A message&#8217;s recipient, subject, and body are defined using the FBs respective inputs. Optionally, an attachment can be defined, allowing arrays of data to be included as an attachment to the email.</p>



<p class="wp-block-paragraph">A message request is triggered on the rising edge of the REQ input. The block executes asynchronously over several cycles, during which the BUSY output will remain high. If the email is sent successfully, the DONE output will pulse for a single scan. If it fails, the ERROR output will pulse, and the STATUS will update with the relevant error code.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/email-function-block.png" alt="function block for sending email"/></figure>



<p class="wp-block-paragraph">There you have it! These steps provide the basic outlining for setting up an SMTP client on a Siemens 1500 PLC. For additional information, see the related <a href="https://support.industry.siemens.com/cs/document/46817803/sending-emails-to-smtp-servers-with-an-s7-cpu?dti=0&amp;lc=en-US" type="link" id="https://support.industry.siemens.com/cs/document/46817803/sending-emails-to-smtp-servers-with-an-s7-cpu?dti=0&amp;lc=en-US">Siemens application example</a> in addition to the help files associated with the TMAIL_C connect block.</p>



<p class="wp-block-paragraph">Feel free to <a href="/contact">contact DMC</a> with any questions or project inquiries and learn more about our <a href="/services/manufacturing-automation-and-intelligence/plc-programming">PLC Programming services</a>&nbsp;and our <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens expertise</a>.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21143/sending-emails-with-a-siemens-1500-plc/">Sending Emails with a Siemens 1500 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Using XML Templates in TIA Openness</title>
		<link>https://static.dmcinfo.com/blog/21173/using-xml-templates-in-tia-openness/</link>
		
		<dc:creator><![CDATA[Patrick Smith]]></dc:creator>
		<pubDate>Thu, 01 Aug 2019 09:35:26 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[Openness]]></category>
		<category><![CDATA[TIA Portal]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21173/using-xml-templates-in-tia-openness/</guid>

					<description><![CDATA[<p>In my previous post, we looked at how Openness formats the XML files that it uses to create objects in TIA Portal. After reviewing some examples, we concluded that creating code in XML can be very complicated and that it is best to use existing blocks to generate XML using Openness. On the surface, that [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21173/using-xml-templates-in-tia-openness/">Using XML Templates in TIA Openness</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><a href="/latest-thinking/blog/id/9908/how-to-read-an-openness-xml-file">In my previous post</a>, we looked at how Openness formats the XML files that it uses to create objects in TIA Portal. After reviewing some examples, we concluded that creating code in XML can be very complicated and that it is best to use existing blocks to generate XML using Openness.</p>



<p class="wp-block-paragraph">On the surface, that doesn’t seem very useful, since writing code requires you to have already written code. However, another way to look at it is that by writing your desired code once, you can use Openness to automatically generate the code as much as needed. By creating XML templates, your Openness application can be used to quickly generate new code from an existing codebase.</p>



<h2 class="wp-block-heading" id="h-what-is-a-template-for">What is a Template For?</h2>



<p class="wp-block-paragraph">Let’s take a step back and consider when generating code from a template using Openness is more useful than creating the necessary code yourself in TIA Portal. Imagine you are in charge of maintaining the PLC code for your company’s line of modular conveyor systems. When a customer wants to order a conveyor system, they choose from the dozens of available modules and arrange them in the configuration that suits their needs. Since you’re a smart programmer, you’ve created a set of function blocks that can control each module.</p>



<p class="wp-block-paragraph">When it comes time to develop the final PLC program, you have to copy in your existing modules, link them to the appropriate inputs and outputs, create the handshakes for passing data between each module, collect each module’s fault codes and send them to the master controller, and the list can go on and on. For large systems, this can become very tedious and time-consuming. However, you can take your modules, export them to XML, and with a little tweaking, allow Openness to automatically insert the relevant data and create the code for you.</p>



<h2 class="wp-block-heading" id="h-creating-a-template">Creating a Template</h2>



<p class="wp-block-paragraph">The first step of automating your code generation is to create your template files. We’ll start by using Openness to create the XML file, and then we’ll add some modifications that will allow our Openness application to fill in data for us.</p>



<p class="wp-block-paragraph">To keep things simple, we’ll assume we have 3 modules that have been packaged into function blocks called <strong>fbModule1</strong>,<strong> fbModule2</strong>, and <strong>fbModule3</strong>. Each module has the same block interface. There’s an input for the motor feedback, an interlock signal from the upstream module, a module ID that the block uses for fault messaging, an output to turn on the motor, and an interlock sent to the downstream module.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Module-example.png" alt="fb module example"/></figure>



<p class="wp-block-paragraph">Since the modules are completely self-contained blocks, in this case, there’s no need to create templates for them. As long as they are part of the final TIA Portal project, we just need a template for creating the block calls and assigning the tags. We’ll also need a template for the instance data blocks, a template for creating the I/O tags, and a template for the global data block that will contain the handshake bits.</p>



<p class="wp-block-paragraph">Let’s start with the I/O tags. I’ve created a tag table called IO and added one input and one output.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Document>
&lt;SW.Tags.PlcTagTable ID="0">
    &lt;AttributeList>
      &lt;Name>IO&lt;/Name>
    &lt;/AttributeList>
    &lt;ObjectList>
      &lt;SW.Tags.PlcTag ID="1" CompositionName="Tags">
        &lt;AttributeList>
          &lt;DataTypeName>Bool&lt;/DataTypeName>
          &lt;ExternalAccessible>true&lt;/ExternalAccessible>
          &lt;ExternalVisible>true&lt;/ExternalVisible>
          &lt;ExternalWritable>true&lt;/ExternalWritable>
          &lt;LogicalAddress>%I0.0&lt;/LogicalAddress>
          &lt;Name>I_Section1Running&lt;/Name>
        &lt;/AttributeList>
        &lt;ObjectList>
          &lt;MultilingualText ID="2" CompositionName="Comment">
            &lt;ObjectList>
              &lt;MultilingualTextItem ID="3" CompositionName="Items">
                &lt;AttributeList>
                  &lt;Culture>en-US&lt;/Culture>
                  &lt;Text>Section 1 motor running&lt;/Text>
                &lt;/AttributeList>
              &lt;/MultilingualTextItem>
            &lt;/ObjectList>
          &lt;/MultilingualText>
        &lt;/ObjectList>
      &lt;/SW.Tags.PlcTag>
	  &lt;SW.Tags.PlcTag ID="10" CompositionName="Tags">
        &lt;AttributeList>
          &lt;DataTypeName>Bool&lt;/DataTypeName>
          &lt;ExternalAccessible>true&lt;/ExternalAccessible>
          &lt;ExternalVisible>true&lt;/ExternalVisible>
          &lt;ExternalWritable>true&lt;/ExternalWritable>
          &lt;LogicalAddress>%Q0.0&lt;/LogicalAddress>
          &lt;Name>Q_Section1Run&lt;/Name>
        &lt;/AttributeList>
        &lt;ObjectList>
          &lt;MultilingualText ID="11" CompositionName="Comment">
            &lt;ObjectList>
              &lt;MultilingualTextItem ID="12" CompositionName="Items">
                &lt;AttributeList>
                  &lt;Culture>en-US&lt;/Culture>
                  &lt;Text>Run section 1 motor&lt;/Text>
                &lt;/AttributeList>
              &lt;/MultilingualTextItem>
            &lt;/ObjectList>
          &lt;/MultilingualText>
        &lt;/ObjectList>
      &lt;/SW.Tags.PlcTag>
	 &lt;/Document></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Tags.PlcTagTable</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;0&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">IO</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Tags&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Bool</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">%I0.0</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">I_Section1Running</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;2&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;3&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Section 1 motor running</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;10&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Tags&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Bool</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">%Q0.0</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Q_Section1Run</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;11&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;12&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Run section 1 motor</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	 </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">This XML needs to be broken into 2 parts: the XML for the tag table, where we will add tags, and the XML for a tag, which we will fill in with the relevant data. To create these templates, delete the data that we will replicate, and add a placeholder that your application will use to perform the replacement. I like the syntax <strong>{Placeholder_Name}</strong>.</p>



<p class="wp-block-paragraph">Here are my templates for the tag table and tags.</p>



<p class="wp-block-paragraph"><strong>Tag Table Template:</strong></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Document>
  &lt;SW.Tags.PlcTagTable ID="0">
    &lt;AttributeList>
      &lt;Name>IO&lt;/Name>
    &lt;/AttributeList>
    &lt;ObjectList>
		{Tags}
	&lt;/ObjectList>
   &lt;/SW.Tags.PlcTagTable>
 &lt;/Document></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Tags.PlcTagTable</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;0&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">IO</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		{Tags}</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">   </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Tags.PlcTagTable</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>Tag Template:</strong></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;SW.Tags.PlcTag ID="{Iterate}" CompositionName="Tags">
&lt;AttributeList>
       &lt;DataTypeName>Bool&lt;/DataTypeName>
       &lt;ExternalAccessible>true&lt;/ExternalAccessible>
       &lt;ExternalVisible>true&lt;/ExternalVisible>
       &lt;ExternalWritable>true&lt;/ExternalWritable>
	   &lt;LogicalAddress>{Address}&lt;/LogicalAddress>
	   &lt;Name>{TagName}&lt;/Name>
&lt;/AttributeList>
		&lt;ObjectList>
          &lt;MultilingualText ID="{Iterate}" CompositionName="Comment">
            &lt;ObjectList>
              &lt;MultilingualTextItem ID="{Iterate}" CompositionName="Items">
                &lt;AttributeList>
                  &lt;Culture>en-US&lt;/Culture>
                  &lt;Text>{Tag Comment}&lt;/Text>
                &lt;/AttributeList>
              &lt;/MultilingualTextItem>
            &lt;/ObjectList>
          &lt;/MultilingualText>
        &lt;/ObjectList>
&lt;/SW.Tags.PlcTag></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Tags&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Bool</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">DataTypeName</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalAccessible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalVisible</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">       </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ExternalWritable</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	   </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{Address}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">LogicalAddress</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	   </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{TagName}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{Tag Comment}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Tags.PlcTag</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">In the Openness application, for each module, we would use the tag template to fill in<strong> {Address}</strong>, <strong>{TagName}</strong>, <strong>{TagComment}</strong>, and <strong>{Iterate}</strong>. These tags would then be grouped together and inserted into the tag template at the <strong>{Tags}</strong> placeholder. How you get this data is up to you. An easy solution is to read in a user-created Excel table, such as the following.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Excel-Data.png" alt="Excel data"/></figure>



<p class="wp-block-paragraph">The application would create the input and output tags for each module and could be set up to give specific tag names depending on the section and module. For example, the tags for Section 1 could be named “I_Section1MotorRunning” and “Q_RunSection1Motor”. The final XML file would contain all the I/O tags, ready to be imported into the project.</p>



<p class="wp-block-paragraph">A similar process could be done for the<strong> global data block.</strong> The format is similar to that of the tag table. The resulting templates would look something like the code below.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Document>
  &lt;SW.Blocks.GlobalDB ID="0">
    &lt;AttributeList>
      &lt;AutoNumber>true&lt;/AutoNumber>
      &lt;HeaderAuthor />
      &lt;HeaderFamily />
      &lt;HeaderName />
      &lt;HeaderVersion>0.1&lt;/HeaderVersion>
      &lt;Interface>
		 &lt;Sections xmlns="http://www.siemens.com/automation/Openness/SW/Interface/v2">
  			&lt;Section Name="Static">
			{Tags}
			&lt;/Section>
		&lt;/Sections>
	 &lt;IsOnlyStoredInLoadMemory>false&lt;/IsOnlyStoredInLoadMemory>
      &lt;IsRetainMemResEnabled>false&lt;/IsRetainMemResEnabled>
      &lt;IsWriteProtectedInAS>false&lt;/IsWriteProtectedInAS>
      &lt;MemoryLayout>Optimized&lt;/MemoryLayout>
      &lt;MemoryReserve>100&lt;/MemoryReserve>
      &lt;Name>dbHandshakes&lt;/Name>
      &lt;Number>6&lt;/Number>
      &lt;ProgrammingLanguage>DB&lt;/ProgrammingLanguage>
    &lt;/AttributeList>
    &lt;ObjectList>
      &lt;MultilingualText ID="1" CompositionName="Comment">
        &lt;ObjectList>
          &lt;MultilingualTextItem ID="2" CompositionName="Items">
            &lt;AttributeList>
              &lt;Culture>en-US&lt;/Culture>
              &lt;Text />
            &lt;/AttributeList>
          &lt;/MultilingualTextItem>
        &lt;/ObjectList>
      &lt;/MultilingualText>
      &lt;MultilingualText ID="3" CompositionName="Title">
        &lt;ObjectList>
          &lt;MultilingualTextItem ID="4" CompositionName="Items">
            &lt;AttributeList>
              &lt;Culture>en-US&lt;/Culture>
              &lt;Text />
            &lt;/AttributeList>
          &lt;/MultilingualTextItem>
        &lt;/ObjectList>
      &lt;/MultilingualText>
    &lt;/ObjectList>
  &lt;/SW.Blocks.GlobalDB>
&lt;/Document></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Blocks.GlobalDB</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;0&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderAuthor</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderFamily</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderName</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">0.1</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Interface</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		 </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Sections</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">xmlns</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;http://www.siemens.com/automation/Openness/SW/Interface/v2&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  			</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Section</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Static&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">			{Tags}</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Section</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Sections</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	 </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">IsOnlyStoredInLoadMemory</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">IsOnlyStoredInLoadMemory</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">IsRetainMemResEnabled</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">IsRetainMemResEnabled</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">IsWriteProtectedInAS</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">IsWriteProtectedInAS</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MemoryLayout</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Optimized</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MemoryLayout</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MemoryReserve</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">100</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MemoryReserve</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">dbHandshakes</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Number</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">6</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Number</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">DB</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;2&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;3&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Title&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;4&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Blocks.GlobalDB</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The data block tags would use the tag template, and the {TagName} and {TagComment} fields would be filled in. The created tags would be used in the {Tags} placeholder in the data block template. Creating the instance data block template is very simple since each data block can be in a separate XML file. All that needs to be filled in is the function block name, the data block name, and the datablock number.</p>



<p class="wp-block-paragraph">This assumes that each module has the same block interface. If any module was different, it would need its own instance data block template. Note that I’ve hidden the Interface section in the below template to make it easier to read.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Document>
&lt;SW.Blocks.InstanceDB ID="0">
    &lt;AttributeList>
      &lt;AutoNumber>false&lt;/AutoNumber>
      &lt;HeaderAuthor />
      &lt;HeaderFamily />
      &lt;HeaderName />
      &lt;HeaderVersion>0.1&lt;/HeaderVersion>
	  &lt;InstanceOfName>{FunctionBlockName}&lt;/InstanceOfName>
      &lt;Interface>
	&lt;MemoryLayout>Optimized&lt;/MemoryLayout>
      &lt;Name>{BlockName}&lt;/Name>
      &lt;Number>{BlockNumber}&lt;/Number>
      &lt;ProgrammingLanguage>DB&lt;/ProgrammingLanguage>
    &lt;/AttributeList>
	&lt;ObjectList>
      &lt;MultilingualText ID="1" CompositionName="Comment">
        &lt;ObjectList>
          &lt;MultilingualTextItem ID="2" CompositionName="Items">
            &lt;AttributeList>
              &lt;Culture>en-US&lt;/Culture>
              &lt;Text />
            &lt;/AttributeList>
          &lt;/MultilingualTextItem>
        &lt;/ObjectList>
      &lt;/MultilingualText>
      &lt;MultilingualText ID="3" CompositionName="Title">
        &lt;ObjectList>
          &lt;MultilingualTextItem ID="4" CompositionName="Items">
            &lt;AttributeList>
              &lt;Culture>en-US&lt;/Culture>
              &lt;Text />
            &lt;/AttributeList>
          &lt;/MultilingualTextItem>
        &lt;/ObjectList>
      &lt;/MultilingualText>
    &lt;/ObjectList>
  &lt;/SW.Blocks.InstanceDB>
&lt;/Document></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Blocks.InstanceDB</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;0&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderAuthor</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderFamily</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderName</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">0.1</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">InstanceOfName</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{FunctionBlockName}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">InstanceOfName</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Interface</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MemoryLayout</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Optimized</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MemoryLayout</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{BlockName}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Name</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Number</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{BlockNumber}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Number</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">DB</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;2&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;3&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Title&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;4&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Blocks.InstanceDB</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">Finally, we can create our template for the block calls. In this case, I’ll call all the modules from our PLC’s OB1. We will need 2 templates again; one for the network, and one for the constant that will be linked to the iInModuleID parameter. I’ve hidden a few sections for readability.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Member Name="{Name}" Datatype="Int" Accessibility="Public">
	&lt;Comment>
	  &lt;MultiLanguageText Lang="en-US">{Comment}&lt;/MultiLanguageText>
	&lt;/Comment>
	  &lt;StartValue>{Value}&lt;/StartValue>
&lt;/Member></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Member</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Name}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Datatype</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Int&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Accessibility</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Public&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Lang</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;en-US&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{Comment}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">StartValue</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">{Value}</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">StartValue</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Member</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;SW.Blocks.CompileUnit ID="{Iterate}" CompositionName="CompileUnits">
      &lt;AttributeList>
        &lt;NetworkSource>
		&lt;FlgNet xmlns="http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v1">
  &lt;Parts>
    &lt;Access Scope="GlobalVariable" UId="{Iterate}">
      &lt;Symbol>
        &lt;Component Name="{MotorRunningTag}" />
      &lt;/Symbol>
    &lt;/Access>
    &lt;Access Scope="GlobalVariable" UId="{Iterate}">
      &lt;Symbol>
        &lt;Component Name="dbHandshakes" />
        &lt;Component Name="{InterlockInputTag}" />
      &lt;/Symbol>
    &lt;/Access>
    &lt;Access Scope="LocalConstant" UId="{Iterate}">
      &lt;Constant Name="{ModuleIDTag}" />
    &lt;/Access>
    &lt;Access Scope="GlobalVariable" UId="{Iterate}">
      &lt;Symbol>
        &lt;Component Name="{MotorRunTag}" />
      &lt;/Symbol>
    &lt;/Access>
    &lt;Access Scope="GlobalVariable" UId="{Iterate}">
      &lt;Symbol>
        &lt;Component Name="dbHandshakes" />
        &lt;Component Name="bSection1OK" />
      &lt;/Symbol>
    &lt;/Access>
    &lt;Call UId="26">
      &lt;CallInfo Name="fbModule3" BlockType="FB">
        &lt;Instance UId="27" Scope="GlobalVariable">
          &lt;Component Name="dbIns_Section1" />
        &lt;/Instance>
        &lt;Parameter Name="bInMotorRunning" Section="Input" Type="Bool" />
        &lt;Parameter Name="bInOkToRun" Section="Input" Type="Bool" />
        &lt;Parameter Name="iInModuleID" Section="Input" Type="Int" />
        &lt;Parameter Name="bOutRunMotor" Section="Output" Type="Bool" />
        &lt;Parameter Name="bOutModuleOK" Section="Output" Type="Bool" />
      &lt;/CallInfo>
    &lt;/Call>
  &lt;/Parts>
  &lt;Wires>
  &lt;/FigNet>
  &lt;/NetworkSource>
  &lt;ProgrammingLanguage>LAD&lt;/ProgrammingLanguage>
 &lt;/AttributeList>
	&lt;ObjectList>
&lt;/SW.Blocks.CompileUnit></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Blocks.CompileUnit</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;CompileUnits&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NetworkSource</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">FlgNet</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">xmlns</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v1&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parts</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;GlobalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{MotorRunningTag}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;GlobalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;dbHandshakes&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{InterlockInputTag}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;LocalConstant&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Constant</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{ModuleIDTag}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;GlobalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{MotorRunTag}&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;GlobalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;{Iterate}&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;dbHandshakes&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bSection1OK&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Call</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;26&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">CallInfo</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;fbModule3&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">BlockType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;FB&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Instance</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;27&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;GlobalVariable&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;dbIns_Section1&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Instance</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parameter</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInMotorRunning&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Section</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Input&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parameter</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInOkToRun&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Section</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Input&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parameter</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;iInModuleID&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Section</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Input&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Int&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parameter</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutRunMotor&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Section</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Output&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parameter</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutModuleOK&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Section</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Output&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">CallInfo</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Call</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Parts</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wires</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">FigNet</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">NetworkSource</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">LAD</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Blocks.CompileUnit</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The application will use the {Name}, {Comment}, and {Value} placeholders to create the constant tags. The block calls will require filling in all the input and output parameters, as well as the function block and instance data block. Once all the code elements have been generated from templates, they can be imported into the project. If all goes well, your project is now ready to run the system!</p>



<p class="wp-block-paragraph">While setting up these templates is a difficult and time-consuming process, it can have a lot of benefits in the long run. Once the templates are created, any future projects can be created with a few lines in Excel and the click of a button. It also makes code updates easy. Any changes to a template will be reflected in all projects that are then generated from the template.</p>



<p class="wp-block-paragraph">By letting Openness handle the low-level, repetitive details of your code, you can quickly layout a project architecture that makes use of clean, reusable code.</p>



<p class="wp-block-paragraph">Learn more about our <a href="/services/manufacturing-automation-and-intelligence/plc-programming">PLC Programming</a> and <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming/">TIA Development</a> Services. <a href="/contact">Contact us</a> for more information.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21173/using-xml-templates-in-tia-openness/">Using XML Templates in TIA Openness</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Read an Openness XML File</title>
		<link>https://static.dmcinfo.com/blog/21358/how-to-read-an-openness-xml-file/</link>
		
		<dc:creator><![CDATA[Patrick Smith]]></dc:creator>
		<pubDate>Thu, 27 Jun 2019 08:36:02 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[Openness]]></category>
		<category><![CDATA[TIA Portal]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21358/how-to-read-an-openness-xml-file/</guid>

					<description><![CDATA[<p>In my previous post, I explained what TIA Openness is and how using it can streamline your development process. Since Openness uses XML files as the basis for its import and export functions, knowing how to understand these XML files is vital for creating and modifying code with Openness. Becoming fluent in the XML structure [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21358/how-to-read-an-openness-xml-file/">How to Read an Openness XML File</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In <a href="/latest-thinking/blog/id/9877/advantages-disadvantages-of-siemens-tia-openness">my previous post</a>, I explained what <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming/">TIA Openness</a> is and how using it can streamline your development process. Since Openness uses XML files as the basis for its import and export functions, knowing how to understand these XML files is vital for creating and modifying code with Openness.</p>



<p class="wp-block-paragraph">Becoming fluent in the XML structure of Openness is not a quick and easy process; it takes time and a lot of experience. However, with the basics I’ll cover in this post, you’ll have the tools and background you need to take your first steps.</p>



<h2 class="wp-block-heading" id="h-reading-an-xml-file">Reading an XML File</h2>



<p class="wp-block-paragraph">XML stands for <strong>eXtensible Markup Language</strong> and is a language used for storing data. Like HTML, it is a markup language, and is meant to be self-descriptive. XML is great for storing complex data structures since it encodes them in a hierarchical tag structure. Let’s take a look at a simple piece of XML.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;email>
	&lt;to>Alice&lt;/to>
	&lt;from>Bob&lt;/from>
	&lt;subject>XML&lt;/subject>
	&lt;message>Isn't XML the best?&lt;/message>
&lt;/email></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">email</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">to</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Alice</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">to</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">from</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Bob</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">from</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">subject</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">XML</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">subject</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">message</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Isn&apos;t XML the best?</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">message</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">email</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">This code represents an email. You can see that within the Email object, it contains information for To, From, Subject, and Message. These elements are children of the Email parent. Unlike HTML, XML has no predefined tags. Having no predefined tags allows the creator of XML to make those tags as descriptive as possible. XML also relies on other programs to read and write it; it does not do anything by itself. For the sample code above, someone must have created a program to store emails. In order to do something with those stored emails, there needs to be a program that converts the XML to a more human-friendly format.</p>



<p class="wp-block-paragraph">This is all that Openness does; it takes XML files that contain all the information needed for, say, a function block, reads them, and processes that information to make a new function block. When Openness exports a function block (or other piece of code), it converts all that data to an XML format. This means that when you open an Openness XML document, it will contain many tags that have been defined by Siemens. These tags are descriptive but can be hard to understand at first glance. Here’s a snippet of a function block in XML.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;Document>
  &lt;SW.Blocks.FB ID="0">
    &lt;AttributeList>
      &lt;AutoNumber>true&lt;/AutoNumber>
      &lt;HeaderAuthor />
      &lt;HeaderFamily />
      &lt;HeaderName />
      &lt;HeaderVersion>0.1&lt;/HeaderVersion>
      &lt;Interface>
		  &lt;Sections xmlns="http://www.siemens.com/automation/Openness/SW/Interface/v2">
  			&lt;Section Name="Input">
    			&lt;Member Name="bInCondition" Datatype="Bool" Remanence="NonRetain" Accessibility="Public">
					&lt;AttributeList>
						&lt;BooleanAttribute Name="ExternalAccessible" SystemDefined="true">false&lt;/BooleanAttribute>
						&lt;BooleanAttribute Name="ExternalVisible" SystemDefined="true">false&lt;/BooleanAttribute>
						&lt;BooleanAttribute Name="ExternalWritable" SystemDefined="true">false&lt;/BooleanAttribute>
					&lt;/AttributeList>
					&lt;Comment>
						&lt;MultiLanguageText Lang="en-US">Input condition&lt;/MultiLanguageText>
					&lt;/Comment>
				&lt;/Member>
  			&lt;/Section>
 			&lt;Section Name="Output">
    			&lt;Member Name="bOutDoSomething" Datatype="Bool" Remanence="NonRetain" Accessibility="Public">
					&lt;AttributeList>
						&lt;BooleanAttribute Name="ExternalAccessible" SystemDefined="true">false&lt;/BooleanAttribute>
						&lt;BooleanAttribute Name="ExternalVisible" SystemDefined="true">false&lt;/BooleanAttribute>
						&lt;BooleanAttribute Name="ExternalWritable" SystemDefined="true">false&lt;/BooleanAttribute>
					&lt;/AttributeList>
					&lt;Comment>
						&lt;MultiLanguageText Lang="en-US">Output action&lt;/MultiLanguageText>
					&lt;/Comment>
				&lt;/Member>
  			&lt;/Section></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Document</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Blocks.FB</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;0&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">true</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AutoNumber</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderAuthor</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderFamily</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderName</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">0.1</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">HeaderVersion</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Interface</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Sections</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">xmlns</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;http://www.siemens.com/automation/Openness/SW/Interface/v2&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  			</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Section</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Input&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    			</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Member</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInCondition&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Datatype</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Remanence</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;NonRetain&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Accessibility</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Public&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalAccessible&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalVisible&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalWritable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Lang</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;en-US&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Input condition</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Member</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  			</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Section</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4"> 			</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Section</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Output&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    			</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Member</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutDoSomething&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Datatype</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Bool&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Remanence</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;NonRetain&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Accessibility</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Public&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalAccessible&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalVisible&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;ExternalWritable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">SystemDefined</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">false</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">BooleanAttribute</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Lang</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;en-US&quot;</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Output action</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultiLanguageText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Comment</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Member</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  			</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Section</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">This is part of the block interface of a function block. Let’s start at the top and work our way down.</p>



<p class="wp-block-paragraph"><strong>The Document Tag</strong><br>
The first element is the ‘Document’ tag. This tag is just used to delineate the start and end of the XML file. Each XML file you create for Openness should only contain one “Document” tag. Next, we have ‘SW.Blocks.FB ID=”0”’.</p>



<p class="wp-block-paragraph"><strong>SW.Blocks.FB</strong><br>
The ‘SW.Blocks.FB’ tells Openness that we are defining a function block. In a similar fashion, we could use ‘SW.Blocks.DB’ to define a data block. The ‘ID=”0”’ part is an internal ID used by Openness. This ID is only used to identify the different data within the XML file. If you have multiple blocks defined inside one ‘Document’ tag, each block will need to have a unique ID, or the import process will fail. In the event of an error, Openness will use these ID numbers to specify where the error occurred.</p>



<p class="wp-block-paragraph">Every function block has certain attributes, which are encapsulated in the ‘AttributeList’ tag. A lot of these attributes will look similar to ones you see when you go to the properties of the function block in Portal. For example, we have a value for ‘AutoNumber’ that tells us if the function block number is set automatically or manually. The ‘HeaderAuthor’, ‘HeaderFamily’, ‘HeaderName’, and ‘HeaderVersion’ attributes can be found in the properties of the block as well. The ‘Interface’ tag is used to define the block interface of the function block.</p>



<p class="wp-block-paragraph"><strong>Sections</strong><br>
The interface contains a set of ‘Sections’. A ‘Section’ is one of the different types of data that a function block can contain. In this example, we have a section named ‘Input’ and a section named ‘Output’. These correspond to the input and output parameters of the block, respectively. To define an input parameter, we create a ‘Member’ in the ‘Input’ section. In the above image, we have an input parameter called ‘bInCondition’. A member has its own set of attributes.</p>



<p class="wp-block-paragraph"><strong>Members</strong><br>
In the ‘Member’ definition, there are ‘Name’, ‘Datatype’, ‘Remanence’, and ‘Accessibility’ attributes. These correspond to the name of the variable, its datatype, whether or not it is retentive, and who can access the variable. Additional attributes are defined in the enclosed ‘AttributeList’. These three attributes, ‘ExternalAccessible’, ‘ExternalVisible’, and ‘ExternalWritable’ correspond to the checkboxes you see in Portal: ‘Accessible from HMI’, ‘Writable from HMI’, and ‘Visible in HMI engineering’.</p>



<p class="wp-block-paragraph"><strong>The Comment Attribute</strong><br>
Finally, the ‘Member’ contains a ‘Comment’ attribute. The comment contains a ‘MultiLanguageText’ attribute that contains the actual comment value. If you are programming in multiple languages, additional ‘MultiLanguageText’ attributes would be defined, and would allow the comment to appear in multiple languages. By setting the values of these attributes, you can fully define the variable. So the XML code above translates into the following block definition.</p>



<p class="wp-block-paragraph"><strong><strong></strong></strong></p>



<p class="wp-block-paragraph"><seems a="" get="" like="" lot="" of="" simple="" so="" something="" text="" to=""> </seems></p>



<h2 class="wp-block-heading" id="h-creating-code-from-xml">Creating Code from XML</h2>



<p class="wp-block-paragraph">Let’s start by looking at a few examples. Here’s a network in our existing function block.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/fb-network-1.png" alt="FB network"/></figure>



<p class="wp-block-paragraph">And here’s the associated XML.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">XML</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;SW.Blocks.CompileUnit ID="3" CompositionName="CompileUnits">
        &lt;AttributeList>
          &lt;NetworkSource>
			  &lt;FlgNet xmlns="http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v1">
 				&lt;Parts>
    				&lt;Access Scope="LocalVariable" UId="21">
      					&lt;Symbol>
        						&lt;Component Name="bInCondition" />
      					&lt;/Symbol>
    				&lt;/Access>
    				&lt;Access Scope="LocalVariable" UId="22">
      					&lt;Symbol>
        						&lt;Component Name="bOutDoSomething" />
     					&lt;/Symbol>
   					&lt;/Access>
    				&lt;Part Name="Contact" UId="23" />
    				&lt;Part Name="Coil" UId="24" />
  				&lt;/Parts>
  				&lt;Wires>
    				&lt;Wire UId="25">
      					&lt;Powerrail />
      					&lt;NameCon UId="23" Name="in" />
    				&lt;/Wire>
    				&lt;Wire UId="26">
      					&lt;IdentCon UId="21" />
      					&lt;NameCon UId="23" Name="operand" />
    				&lt;/Wire>
    				&lt;Wire UId="27">
     					&lt;NameCon UId="23" Name="out" />
      					&lt;NameCon UId="24" Name="in" />
    				&lt;/Wire>
    				&lt;Wire UId="28">
      					&lt;IdentCon UId="22" />
      					&lt;NameCon UId="24" Name="operand" />
    				&lt;/Wire>
  				&lt;/Wires>
			&lt;/FlgNet>
		&lt;/NetworkSource>
        &lt;ProgrammingLanguage>LAD&lt;/ProgrammingLanguage>
      &lt;/AttributeList>
        &lt;ObjectList>
          &lt;MultilingualText ID="4" CompositionName="Comment">
            &lt;ObjectList>
              &lt;MultilingualTextItem ID="5" CompositionName="Items">
                &lt;AttributeList>
                  &lt;Culture>en-US&lt;/Culture>
                  &lt;Text>This network uses an input condition to activate an output action&lt;/Text>
                &lt;/AttributeList>
              &lt;/MultilingualTextItem>
            &lt;/ObjectList>
          &lt;/MultilingualText>
          &lt;MultilingualText ID="6" CompositionName="Title">
            &lt;ObjectList>
              &lt;MultilingualTextItem ID="7" CompositionName="Items">
                &lt;AttributeList>
                  &lt;Culture>en-US&lt;/Culture>
                  &lt;Text>Simple contact/coil network&lt;/Text>
                &lt;/AttributeList>
              &lt;/MultilingualTextItem>
            &lt;/ObjectList>
          &lt;/MultilingualText>
        &lt;/ObjectList>
      &lt;/SW.Blocks.CompileUnit></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">SW.Blocks.CompileUnit</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;3&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;CompileUnits&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NetworkSource</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">			  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">FlgNet</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">xmlns</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v1&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4"> 				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Parts</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;LocalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;21&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInCondition&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Access</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Scope</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;LocalVariable&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;22&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        						</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Component</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutDoSomething&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">     					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Symbol</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">   					</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Access</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Part</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Contact&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;23&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Part</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Coil&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;24&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Parts</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wires</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wire</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;25&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Powerrail</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NameCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;23&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;in&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Wire</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wire</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;26&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">IdentCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;21&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NameCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;23&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;operand&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Wire</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wire</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;27&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">     					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NameCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;23&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;out&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NameCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;24&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;in&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Wire</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Wire</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;28&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">IdentCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;22&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      					</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">NameCon</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">UId</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;24&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;operand&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #808080">/&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">    				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Wire</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">  				</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Wires</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">FlgNet</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">NetworkSource</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">LAD</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ProgrammingLanguage</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;4&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Comment&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;5&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">This network uses an input condition to activate an output action</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualText</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;6&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Title&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ID</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;7&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">CompositionName</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Items&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">en-US</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Culture</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span><span style="color: #D4D4D4">Simple contact/coil network</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Text</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">AttributeList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">              </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualTextItem</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">          </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">MultilingualText</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">ObjectList</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">      </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">SW.Blocks.CompileUnit</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The XML, while more complicated than the ladder logic view, is still relatively readable. There are attributes of the network, a section for declaring all used variables, a section that defines the ladder elements used, and a section that creates the connections between the variables and the separate ladder elements. However, while the sections stay the same, adding more complex elements quickly makes this XML extremely difficult to parse.</p>



<p class="wp-block-paragraph">Here’s an example of creating an instance of the <strong>Open Library fb_ValveSolenoid</strong> function block.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/fb-network-3.png" alt="fb network 3"/></figure>



<p class="wp-block-paragraph">While still a relatively simple network, the XML to encapsulate this network is 187 lines long (I won’t post it here to save space). Every part of the XML has to be accurately defined, or you will end up with import errors. In addition, learning the various pieces that Openness uses to define function blocks takes a lot of practice.</p>



<p class="wp-block-paragraph">For these reasons, it very rarely makes sense to start from scratch to create an XML version of a function block. You can add functions to your Openness application to export existing blocks to XML. Then, you can create your blocks in Portal, and have Openness generate the associated XML automatically. When editing these XML documents, I would recommend using a text editor that has support for proper XML formatting, such as Notepad++ or Visual Studio Code.</p>



<p class="wp-block-paragraph">While being at least somewhat familiar with Openness’ XML format is very useful for debugging purposes, we’ve seen that it can be overwhelming when trying to write code. Using Openness to generate the XML code is easy, but requires creating the desired object in Portal anyway.</p>



<p class="wp-block-paragraph">What then, you might ask, is the point of creating objects in XML? In the next post, I’ll cover how you can use Openness to automate the creation of code using XML templates.</p>



<p class="wp-block-paragraph">Learn more about <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming/">DMC&#8217;s TIA Portal Development</a> and <a href="/contact">contact us</a> for more information.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21358/how-to-read-an-openness-xml-file/">How to Read an Openness XML File</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1</title>
		<link>https://static.dmcinfo.com/blog/26079/linking-plc-udt-tags-to-hmi-faceplates-and-pop-ups-in-tia-portal-v13-sp1/</link>
		
		<dc:creator><![CDATA[Jason Mayes]]></dc:creator>
		<pubDate>Mon, 21 Dec 2015 15:02:47 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[TIA Portal]]></category>
		<category><![CDATA[WinCC]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/26079/linking-plc-udt-tags-to-hmi-faceplates-and-pop-ups-in-tia-portal-v13-sp1/</guid>

					<description><![CDATA[<p>PLEASE NOTE: This blog was written using features available in TIA Portal V13 SP1 Update 1. Some of the functionality shown was removed in Update 3, specifically the ability to multiplex UDTs. Hopefully, the rest of the information will still be helpful to you! Here at DMC, we spend a lot of time programming PLCs [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/26079/linking-plc-udt-tags-to-hmi-faceplates-and-pop-ups-in-tia-portal-v13-sp1/">Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong>PLEASE NOTE: This blog was written using features available in TIA Portal V13 SP1 Update 1. Some of the functionality shown was removed in Update 3, specifically the ability to multiplex UDTs. Hopefully, the rest of the information will still be helpful to you!</strong></p>



<p class="wp-block-paragraph">Here at DMC, we spend a lot of time programming PLCs and HMIs. While we program systems of all types and flavors, I&#8217;m personally most experienced with <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens</a>&nbsp;(TIA Portal) and <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Rockwell</a>&nbsp;(RSLogix5000/FactoryTalk View). There are a few new features included&nbsp;in <a href="https://support.industry.siemens.com/cs/document/104509915/delivery-release-for-simatic-wincc-v13-sp1?dti=0&amp;lc=en-US">TIA Portal V13 SP1</a>&nbsp;that I have found to be incredibly useful&nbsp;in the past few months and have allowed me to be even more efficient in my programming. I&#8217;m going to focus today on a series of updates that were added in SP1 that make it even simpler to take advantage of the nested data structures we can create in our Data Blocks &#8211; specifically, the ability to share UDTs between a PLC and HMI, link UDTs to Faceplates, multiplex arrays of UDTs, and create simple, powerful pop-ups.</p>



<p class="wp-block-paragraph">Before we get started, let me say that if you&#8217;re not already taking advantage of PLC data types and Global DBs to build rich data structures in your project, you&#8217;re missing out. Having come from an object-oriented programming background, I really appreciate what the Function Block/Data Block paradigm will allow you to do in a PLC &#8211; it really does push PLC programming towards object-oriented programming. And let&#8217;s face it, the less time we all spend on repeating tasks and minutiae, the more time we can spend actually programming.</p>



<p class="wp-block-paragraph">As an exercise, let&#8217;s pretend we have a project with a large number of simple valves. Of course, we like to save time, so we&#8217;re going to develop a special FB to handle our valves: auto/manual control, alarms, etc. In addition to eliminating the amount of code to be written, this allows us the additional advantage of&nbsp;keeping our future valve logic updates in a single place.&nbsp;Our FB has a few inputs, including the feedback signals for open/close, an in-out for our &#8216;valve&#8217; data type, and an output for the open/close command.</p>



<p class="wp-block-paragraph">So, what is in our &#8216;valve&#8217; data type? For this simple example, let&#8217;s create the following PLC data type, <em><strong>udtValve</strong></em>:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ValveUDT.png" alt=""/></figure>



<p class="wp-block-paragraph">We&#8217;ve broken our data type into three structures: configuration, status, and control. The configuration group of parameters defines the valve&#8217;s physical behavior and its unique name. The status group contains all status information about the valve and is used both within the PLC and the HMI. The control group has the open/close and fault reset requests. I find breaking things up like this makes it much easier to find the right tag you&#8217;re looking for when programming.</p>



<p class="wp-block-paragraph">For our valve Function Block, <em><strong>fbValve</strong></em>, let&#8217;s say we have something like this:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ValveFunctionBlock.png" alt=""/></figure>



<p class="wp-block-paragraph"><span style="line-height: 1.6;">Now that we&#8217;ve developed a reusable function block for our valves, let&#8217;s create a DB to contain all of our valve data. I&#8217;m going to create a Global DB and name it </span><em style="line-height: 1.6;"><strong>dbValves</strong></em><span style="line-height: 1.6;">. In it, I am going to create an array of </span><em style="line-height: 1.6;"><strong>udtValve</strong></em><span style="line-height: 1.6;">. Within this data block, I can set configuration values, including valve names, for each of the valves I am going to use. Let&#8217;s imagine we&#8217;ll be using 10 valves. As you can see below, I&#8217;ve entered configuration values in each valve&#8217;s data structure.</span></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/dbValves.png" alt=""/></figure>



<p class="wp-block-paragraph"><span style="line-height: 1.6;">The final step on our PLC is to add our newly written code. I&#8217;ve created a FB (</span><em style="line-height: 1.6;"><strong>fbValves</strong></em><span style="line-height: 1.6;">) to contain all of my valves, instantiated 10 valves (multi-instanced versions&nbsp;of </span><em style="line-height: 1.6;"><strong>fbValve</strong></em><span style="line-height: 1.6;">) within it, and dropped </span><em style="line-height: 1.6;"><strong>fBValves</strong></em><span style="line-height: 1.6;"> into OB1.</span></p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/fbValves.png" alt=""/></figure>



<p class="wp-block-paragraph">Now, let&#8217;s move to the HMI. Let&#8217;s say we want to put together a simple P&amp;ID of our system showing each of the valves and their status. Let&#8217;s also imagine we want to allow a user to click on a valve and open a pop-up so that they can get more information as well as control it manually.</p>



<p class="wp-block-paragraph">Let&#8217;s start with the first task &#8211; our simple P&amp;ID. I&#8217;m going to grab a simple valve from the toolbox (under &#8220;Elements &#8211; Symbol Library&#8221;) and add an indicator for the valve name. Under &#8220;Properties &#8211; Appearance&#8221; for the symbol, I&#8217;m going to change the &#8220;Fill Style&#8221; to &#8220;Shaded&#8221;. This will allow me to add some color animation to the valve: Orange/flashing when the valve state is not known, Grey when the valve is closed, and Green when the valve is open. Additionally, I would like the valve&#8217;s name to change to Red and flash when the valve is faulted.</p>



<p class="wp-block-paragraph">I could start adding in my animations now, but I don&#8217;t want to have to redo that process for each valve. Instead, I&#8217;m going to create a faceplate so I can write the logic once and reuse it several times. To do this, select both the valve symbol and the valve name indicator, right-click, choose &#8220;Create Faceplate&#8221;, and name it &#8216;ValveIndicator&#8217;.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/CreateFaceplate.png" alt=""/></figure>



<p class="wp-block-paragraph">Inside the faceplate editor, I could create new properties for the fault status, the valve state, and the valve name, then tie each to the appropriate item/animation. However, this would require linking each of these properties back to the appropriate tag inside of my data structure. With a lot of valves, this could take a lot of work.&nbsp;This is where one of the new TIA Portal V13 SP1 updates will come in handy: the ability to use PLC&nbsp;UDTs (PLC data types)&nbsp;in the HMI.</p>



<p class="wp-block-paragraph">To have access to&nbsp;a PLC data type&nbsp;on the HMI, we will first need to add it to our project library as a type. To do so, just drag&nbsp;<em><strong>udtValve </strong></em>from the PLC project tree into the &#8220;Project Library &#8211; Types&#8221; folder:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ProjectLibrary.png" alt=""/></figure>



<p class="wp-block-paragraph">Now, back to our Faceplate. Let&#8217;s add a new property of type <em><strong>udtValve</strong></em>. Now, when we use this Faceplate, we will only need to link a single tag: all of the individual animations and properties will be internally linked, within the Faceplate, to the appropriate tag within our UDT. Below is my Faceplate and the animation for the valve color. Notice in the Properties window that there is only a single property of type <em><strong>udtValve</strong></em>.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/FaceplateProperties.png" alt=""/></figure>



<p class="wp-block-paragraph">When you&#8217;re finished editing your Faceplate, release the version and let&#8217;s go back to editing our HMI screen. Select the new Faceplate object and view the Interface tab. Link it back to dbValves.Valve[0] by navigating to &#8220;Program Blocks &#8211; dbValves&#8221;.</p>



<p class="wp-block-paragraph">That&#8217;s it! Now we can add more instances of our Faceplate to the screen and simply link a new valve instance to each &#8211; nothing to it!</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Linking-Valve-Tag-to-Faceplate.bmp" alt=""/></figure>



<p class="wp-block-paragraph">So, getting back to our original goal &#8211; we&#8217;ve succeeded in creating a simple Faceplate that can be linked directly to a single tag (UDT).</p>



<p class="wp-block-paragraph">The second task we set out to accomplish was to create a pop-up that can show more detailed information for any given valve. In this case, we want to create our pop-up so that it is capable of being opened to display any one valve at a time. To do this, we will need to set up a &#8216;multiplexing&#8217; tag to look at different valve instances in our array of <em><strong>udtValve</strong></em>. If you&#8217;ve tried this before, you may have run into issues. Luckily, there have been a few updates in V13 SP1!</p>



<p class="wp-block-paragraph">First, let&#8217;s set up our &#8216;multiplexing&#8217; tag. We&#8217;ll need to create an &#8216;index&#8217; tag locally on the HMI that can be used to choose the active valve. In my default tag table, let&#8217;s first create a local <em><strong>Index </strong></em>tag (with type of&nbsp;&#8220;UInt&#8221;). Next, in your project tree and while still looking at your HMI tag table, select <em><strong>dbValves</strong></em>. From the &#8220;Details View&#8221; (see screenshot below), drag <em><strong>Valve[1]</strong></em> over to your HMI&#8217;s default tag table and change the name to <em><strong>IndexedValve</strong></em>:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AddIndexedTag.png" alt=""/></figure>



<p class="wp-block-paragraph">At this point, notice that the HMI Tag is linked to a specific valve within our array of <em><strong>udtValves, dbValves.Valve[1]</strong></em>. Now, select your new <em><strong>IndexedValve </strong></em>tag and open up the property pane below. Select the empty&nbsp;drop-down box for &#8220;Address&#8221; and choose &#8220;HMI Tag&#8221;. Now, navigate to your HMI tags and select &#8220;Index,&#8221; the internal tag we created a few moments ago. At this point you will notice that the PLC Tag name shows &#8220;&lt;Multiplex Tag&gt;&#8221; (instead of <strong><em>dbValves.Valve[1]</em></strong>), and the &#8216;address&#8217; now shows you a dynamic link to array. By setting our <em><strong>Index </strong></em>tag, we can now vary where our <em><strong>IndexedValve </strong></em>is pointed.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/IndexTagSetup.png" alt=""/></figure>



<p class="wp-block-paragraph">Great! Now, let&#8217;s create another faceplate to show whatever information you would like. I&#8217;ve created the faceplate below and configured a single &#8220;udtValve&#8221; property to link it. It will give the user the ability to switch control modes, open and close the valve, and see status information.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/DetailedFaceplate.png" alt=""/></figure>



<p class="wp-block-paragraph">The last piece of our puzzle is the pop-up. This is another great addition to <a href="https://static.dmcinfo.com/blog/26316/wincc-comfort-advanced-v13-sp1-pop-up-screens-and-slide-in-screens/" type="link" id="https://static.dmcinfo.com/blog/26316/wincc-comfort-advanced-v13-sp1-pop-up-screens-and-slide-in-screens/">TIA Portal V13 SP1</a>. To create a pop-up, navigate in the project tree under your HMI to &#8220;Screen Management/Pop-up Screens&#8221;. Add a new pop-up screen and add your new faceplate to it. Select your faceplate and view the &#8220;Interface&#8221; tab under Properties. Now, link your <em><strong>IndexedValve </strong></em>to the faceplate.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/LinkIndexedValve.png" alt=""/></figure>



<p class="wp-block-paragraph">Finally &#8211; our last step. Add an invisible button&nbsp;<span style="line-height: 20.8px;">and place it over one of the valves on your P&amp;ID screen.</span>&nbsp;You can do this by using a button from your HMI toolbox and configuring it to be &#8216;Invisible&#8217; from within the properties. On the button&#8217;s Click Event, add the following:</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ButtonEventConfig.png" alt=""/></figure>



<p class="wp-block-paragraph">Now, when a user clicks on a valve from the P&amp;ID, the triggered event will first update the index of the valve that is chosen, and then show the pop-up screen.</p>



<p class="wp-block-paragraph">There you have it!&nbsp;<span style="line-height: 1.6;">We&#8217;ve taken advantage of several really great features that were added in TIA Portal V13 SP1: the ability to use PLC data types (UDTs) on an HMI, the ability to link a faceplate to a single UDT, the ability to multiplex an array of UDTs, and the ability to add a simple pop-up. As I&#8217;m sure you can imagine, there are many potential uses for these new features and this example is just one possible application. Good luck programming, and let me know if there are any new features you&#8217;ve found that can help me be more efficient in the future! <a href="/contact">Contact us today</a> for help on your next programming project.</span></p>



<p class="wp-block-paragraph"><strong>Learn more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming/">Siemens TIA Portal</a>&nbsp;and <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming">Siemens SCADA</a> solutions.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/26079/linking-plc-udt-tags-to-hmi-faceplates-and-pop-ups-in-tia-portal-v13-sp1/">Linking PLC UDT Tags to HMI Faceplates and Pop-ups in TIA Portal V13 SP1</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Source Code Protection For Your SIMATIC S7-1200 PLC in TIA Portal</title>
		<link>https://static.dmcinfo.com/blog/27258/source-code-protection-for-your-simatic-s7-1200-plc-in-tia-portal/</link>
		
		<dc:creator><![CDATA[Jason Mayes]]></dc:creator>
		<pubDate>Mon, 15 Sep 2014 19:23:44 +0000</pubDate>
				<category><![CDATA[Boston]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[TIA Portal]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/27258/source-code-protection-for-your-simatic-s7-1200-plc-in-tia-portal/</guid>

					<description><![CDATA[<p>From time to time, we&#8217;ll run across situations where a client believes it is necessary to lock down code on a PLC. In some cases, there may be valuable intellectual property they would like to protect. In others, its purpose may be to prevent unauthorized modifications to safety-related code, or activation of disabled options. There [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/27258/source-code-protection-for-your-simatic-s7-1200-plc-in-tia-portal/">Source Code Protection For Your SIMATIC S7-1200 PLC in TIA Portal</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">From time to time, we&#8217;ll run across situations where a client believes it is necessary to lock down code on a PLC. In some cases, there may be valuable intellectual property they would like to protect. In others, its purpose may be to prevent unauthorized modifications to safety-related code, or activation of disabled options. There may also be cases where it is necessary to interlock a PLC program to a specific memory card or CPU, especially in cases where there may be multiple, similar (but slightly different) machines. These machines may run unique software and by using the wrong code (or release) could cause risk to an operator or the machine itself.</p>



<p class="wp-block-paragraph">Luckily, there are tools available within TIA Portal for all of these cases, and it doesn&#8217;t take more than a few minutes to set them up. As I have a 1214C PLC sitting here on my lab bench, I&#8217;m going to use the S7-1200 platform as an example; however, these options could be enabled on other PLCs (such as the 1500 series) as well.</p>



<p class="wp-block-paragraph">TIA Portal contains three different options for code protection:</p>



<ul class="wp-block-list">
<li>Write/Read Protection</li>



<li>Know-how Protection</li>



<li>Copy Protection</li>
</ul>



<p class="wp-block-paragraph">Let&#8217;s take a look at each of these.</p>



<h2 class="wp-block-heading" id="h-write-read-protection"><strong>Write/Read Protection</strong></h2>



<p class="wp-block-paragraph">Write/Read Protection is a CPU property: it can be assigned by viewing the properties of a device. This is done by opening a device in Device View, choosing the &#8220;Properties&#8221; tab, and looking for &#8220;Protection&#8221; under the &#8220;General&#8221; tab. There are three options for Write/Read Protection you can choose from:</p>



<p class="wp-block-paragraph"><em><strong>&#8220;No Protection&#8221;</strong></em> &#8211;&nbsp;This option is the standard and default behavior. With this setting, any user may connect to the PLC, read/write data, or upload/download a program to/from the PLC without any need for a password.<span style="line-height: 1.6; font-size: 13px;">&nbsp;</span></p>



<p class="wp-block-paragraph"><em><strong>&#8220;Write Protection&#8221;</strong></em> &#8211; Selecting this option will prevent an unauthorized user from writing to the PLC. A user may connect to the PLC and upload a program or connect and go online with the PLC and monitor tag values with no need for a password. However, if a user wishes to download an update to the code on the PLC, download a new program, or edit/force tag value while online, a password will be required.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Download-With-Write-Protection.jpg" alt="Siemens Block Protection Download with Write Protection."/></figure>



<p class="wp-block-paragraph"><p style="text-align: center;"><span style="font-size: x-small;"><span style="line-height: 1.6;">With Write Protection enabled, a password is required to download to the PLC.</span></span></p></p>



<p class="wp-block-paragraph"><p style="text-align: center;"><span style="line-height: 1.6;"><br>
<span style="font-size: x-small;">With &#8220;Write Protection&#8221; enabled, it is necessary to first enter the password before tag values may be forced or modified.</span></span><br>
&nbsp;</p></p>



<p class="wp-block-paragraph"><em><strong>&#8220;Write/Read Protection&#8221; </strong></em>&#8211; This setting, when enabled, will offer the same security that is provided while using &#8220;Write Protection&#8221; with the additional benefit of disabling read access without the password. Read protection will prevent a user from uploading code, monitoring tags, or even seeing which blocks are present on a CPU.</p>



<p class="wp-block-paragraph"><p style="text-align: center;"><br>
<span style="font-size: x-small;">With &#8220;Write/Read Protection&#8221; enabled, it is not possible to upload a program from a PLC without the password.</span></p></p>



<h2 class="wp-block-heading" id="h-know-how-protection"><strong>Know-how Protection</strong></h2>



<p class="wp-block-paragraph">Know-how protection is a block-level property that can be set for any OB, FB, FC, or DB. When enabled, a user will be unable to view or modify the actual code or tags within a block without first entering the password. You can enable Know-how Protection either by right clicking on a block in the project tree and selecting &#8220;Know-how Protection,&#8221; or by looking at the block&#8217;s properties and selecting &#8220;Protection.&#8221;</p>



<p class="wp-block-paragraph"><p style="text-align: center;"><span style="font-size: x-small;">&#8220;Know-how Protection&#8221; can be accessed under the block&#8217;s properties. Choose &#8216;Define&#8217; to assign a password for the block.</span></p></p>



<p class="wp-block-paragraph">It should be noted that this property is not recursively applied &#8211; that is, if an OB is Know-how Protected, any FBs of FCs used within that OB will not automatically have the same protection applied. Applying it to one block will not prevent someone from viewing the source code of another block used within it. But, it is possible to select multiple (or all!) blocks within the project tree and apply Know-how Protection to all of the blocks at once.</p>



<p class="wp-block-paragraph"><p style="text-align: center;"><br>
<span style="font-size: x-small;">&#8220;Know-how Protection&#8221; can be enabled for multiple blocks at once.</span></p></p>



<p class="wp-block-paragraph">Once Know-how Protection has been applied to a block, you will notice that the block is immediately recompiled, and a lock icon will appear within the project tree to indicate the block is locked. When you attempt to open any locked block, you will now be prompted for a password in order to see the block&#8217;s source.</p>



<p class="wp-block-paragraph">It&#8217;s important to mention that Know-how protection is not bullet-proof: there are ways to get around it, so it shouldn&#8217;t be the first and last defense for protecting valuable information. It can, however, be useful for discouraging unauthorized changes or managing libraries of function blocks for use within a large project or even within an organization.</p>



<h2 class="wp-block-heading" id="h-copy-protection"><strong>Copy Protection</strong></h2>



<p class="wp-block-paragraph">Finally, we get to Copy Protection. Like Know-how Protection, Copy Protection is also a block property. If you&#8217;ve played with Know-how Protection, you&#8217;ve probably already seen the Copy Protection settings under the block&#8217;s protection properties. Copy Protection is a useful setting that can be used to lock, or bind, a program to a specific PLC or memory card. There are three available Copy Protection settings:</p>



<p class="wp-block-paragraph"><em><strong>&#8220;No Binding&#8221; </strong></em>&#8211; This is the default setting. With no binding enabled, a program may be transferred to any PLC or any memory card and run. If a program is downloaded to one CPU, it could be uploaded to a PC and then downloaded to another PLC and run. Or if copied to a memory card, the card may be inserted to any CPU and the code executed.</p>



<p class="wp-block-paragraph"><em><strong>&#8220;Bind to Serial Number of the Memory Card&#8221; </strong></em>&#8211; When this option is enabled, the block will be bound to the unique serial number of the Memory Card to which it is downloaded. That Memory Card may be moved from PLC to PLC and each CPU will operate with no issues, but if the Memory Card is copied and the new card is used, the CPU will not enter Run. Even if only a single block is bound, the CPU cannot run a program.</p>



<p class="wp-block-paragraph"><em><strong>&#8220;Bind to Serial Number of the PLC&#8221;</strong></em> &#8211; This setting will allow a block to be bound to a specific PLC. The block may not be transferred from one PLC to another, meaning if the CPU needs to be replaced, the same program may not be used.</p>



<p class="wp-block-paragraph">&nbsp;</p>



<p class="wp-block-paragraph"><p style="text-align: center;"><br>
<span style="font-size: x-small;">Blocks may be bound to a specific serial number of a CPU or Memory Card.</span></p></p>



<p class="wp-block-paragraph">One final note about binding: it should noted that if you intend to bind a block to a Memory Card or PLC, you must also enable Know-how Protection for the block. If Know-how Protection is not enabled, it is possible for anyone to open up the block settings and reset the copy protection.</p>



<p class="wp-block-paragraph"><strong>Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/plc-programming">PLC programming services</a>&nbsp;and <a href="/contact">contact us</a> to get started on your next project.&nbsp;</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/27258/source-code-protection-for-your-simatic-s7-1200-plc-in-tia-portal/">Source Code Protection For Your SIMATIC S7-1200 PLC in TIA Portal</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PID with a Siemens S7-1200 PLC</title>
		<link>https://static.dmcinfo.com/blog/28757/pid-with-a-siemens-s7-1200-plc/</link>
		
		<dc:creator><![CDATA[Jason Mayes]]></dc:creator>
		<pubDate>Tue, 16 Oct 2012 12:13:55 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[Motion Control]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/28757/pid-with-a-siemens-s7-1200-plc/</guid>

					<description><![CDATA[<p>A few weeks ago, I had the chance to experiment with serial communications using a Siemens S7-1200 PLC outfitted with a CM1241 (RS-485 module). Due to the limited number of projects we&#8217;ve had using the 1200 line of PLCs, this was an office first. And while it was very straightforward, it was still a learning [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28757/pid-with-a-siemens-s7-1200-plc/">PID with a Siemens S7-1200 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">A few weeks ago, I had the chance to experiment with <a href="https://static.dmcinfo.com/blog/28801/siemens-s7-1200-serial-communication/">serial communications using a Siemens S7-1200 PLC </a>outfitted with a CM1241 (RS-485 module). Due to the limited number of projects we&#8217;ve had using the <a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">1200 line of PLCs</a>, this was an office first. And while it was very straightforward, it was still a learning experience.</p>



<p class="wp-block-paragraph">Recently, I had another chance to be DMC&#8217;s S7-1200 <a href="http://en.wikipedia.org/wiki/The_Oregon_Trail_(video_game)">pioneer </a>&#8211; this time using the S7-1200&#8217;s PID blocks, and luckily, not involving death by dysentery, cholera, or snakebite. Like serial communications, PID was also fairly straightforward. But there were a few things I picked up along the way that may be helpful for the next person looking to close the loop.</p>



<p class="wp-block-paragraph">If you&#8217;ve thought about PID on an S7-1200, you probably know that Siemens is kind enough to provide two PID function blocks in STEP 7: <em>PID_Compact</em> and <em>PID_3Step</em>. For most purposes, I would think <em>PID_Compact</em> (for use with continuous input/output variables) would be sufficient, but if you&#8217;re trying to control motor-actuated devices, such as valves that require digital open/close signals, the <em>PID_3Step </em>block could be very useful. In my case, I was controlling the temperature in a furnace by actuating a proportional valve &#8211; so <em>PID_Compact </em>fit the bill.</p>



<p class="wp-block-paragraph">So, if you&#8217;re looking into using PID on your S7-1200, I hope the following tips may be useful in getting you up to speed.</p>



<p class="wp-block-paragraph"><u><strong>Where are the PID blocks???</strong></u></p>



<p class="wp-block-paragraph">One of the first questions I had after discovering that there were native PID blocks provided in STEP 7 was &#8220;Where are they?&#8221; If you&#8217;re looking, expand the instructions tab on the right side of the development screen in STEP 7. This is the tab that contains all of your tools (timers, counters, math, etc). Under the basic instructions, there&#8217;s another group called &#8220;Technology.&#8221; Expand this, and you should see a group of instructions called <em><strong>PID Control</strong></em>. You can click and drag a block from here directly to your code to add it to your project. But before you add it, be careful where you&#8217;re going to drop it. You don&#8217;t want the PID block to execute every scan (it needs time to respond to changes in the control value); therefore, add it to a cyclic OB. Choose how often your cyclic OB executes based on how fast your process is.</p>



<figure class="wp-block-image aligncenter size-full"><img fetchpriority="high" decoding="async" width="315" height="387" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/FindBlockUnderTechnology.jpg" alt="FindBlockUnderTechnology" class="wp-image-28754" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/FindBlockUnderTechnology.jpg 315w, https://static.dmcinfo.com/wp-content/uploads/2025/05/FindBlockUnderTechnology-244x300.jpg 244w" sizes="(max-width: 315px) 100vw, 315px" /></figure>



<p class="wp-block-paragraph"><u><strong>I threw my PID block in, now what???</strong></u></p>



<p class="wp-block-paragraph">After you&#8217;ve added your block, it&#8217;s up to you to configure it. Luckily, there&#8217;s a very handy configuration tool provided. Just click on the &#8216;toolbox&#8217; icon in the upper right-hand corner of the block to open up the configuration window. This will guide you through the setup. The first set of choices you have is &#8220;<em><strong>Basic Settings</strong></em>.&#8221; This is where you define what kind of inputs/outputs you&#8217;re using. In my case, I wanted to control temperature using a setpoint and input in degrees <em>F</em>, and an output in % that I could feed directly to an analog output to my valve.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="829" height="349" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BasicSettings.jpg" alt="BasicSettings" class="wp-image-28755" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/BasicSettings.jpg 829w, https://static.dmcinfo.com/wp-content/uploads/2025/05/BasicSettings-300x126.jpg 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/BasicSettings-768x323.jpg 768w" sizes="(max-width: 829px) 100vw, 829px" /></figure>



<p class="wp-block-paragraph">Next, if using Input Per, you will need to define your &#8220;<em><strong>Process Value Settings</strong></em>.&#8221; These options will define the scaling used to convert your percentage input to engineering units (for comparison to your setpoint). As I chose to use the input option (not Input_PER), I had nothing to do here.</p>



<p class="wp-block-paragraph">Finally, there are &#8220;<em><strong>Advanced Settings</strong></em>.&#8221; This is where you can take advantage of the built-in warnings for process value monitoring, set minimum on/off times for a PWM output, output value limit values, and manually enter PID gains. It&#8217;s worth noting here that the output options for the block are plentiful &#8211; engineering value, Output_PER, and PWM. And you can use any or all of them simultaneously. So basically, this block is a one-stop shop for any kind of PID control.</p>



<p class="wp-block-paragraph"><u><strong>Is there an auto-tune function???</strong></u></p>



<p class="wp-block-paragraph">Now you&#8217;ve set up your block and have provided inputs/outputs, how do you get started? If you download your program to your PLC you will quickly see that the PID loop is not currently active. You will need to either manually start it, or walk through the tuning procedure. We&#8217;ll get to manual tuning in a moment, so let&#8217;s look at the auto-tune process first.</p>



<p class="wp-block-paragraph">Earlier, we used the &#8220;<em><strong>Toolbox</strong></em>&#8221; icon on the block to configure the block. Right next to that icon is an icon with what looks like a pair of pliers and a yellow warning sign. This is how we enter the auto-tuning process. While the program is running on the PLC and you are online, you can use this icon to launch the tuning window. From here, you can start the auto-tuning process. I think this is fairly straightforward and doesn&#8217;t need much comment, but do remember to be careful before starting auto-tune, as the controller will take over and measure the response to different outputs. Once pre-tuning is complete, you can do further fine-tuning. Once the tuning process is complete, the PID loop will be activated, and you&#8217;re ready to go. That&#8217;s it.</p>



<p class="wp-block-paragraph"><u><strong>Can I manually tune my PID loop???</strong></u></p>



<p class="wp-block-paragraph">Unfortunately, the process I was trying to control did not lend itself well to auto-tuning. In my case, the temperature response of the furnace was incredibly slow, and the lag between output and response was great enough that auto-tuning wasn&#8217;t a viable option. Thankfully, there are manual tuning options as well.</p>



<p class="wp-block-paragraph">I was lucky that I could schedule some time for offline tuning. I was able to heat the furnace up to steady-state, give a step-change in my output, and record the response. The tuning window is still helpful for this, as it will record the process variable for you. Once I had my response, I was able to dig out some old college textbooks and calculate the gains for myself.</p>



<p class="wp-block-paragraph">While you can set gains through the configuration window, I preferred accessing the gains directly through the<em> PID_Compact</em> block&#8217;s datablock. Most of the important values you want are located in the datablock structure &#8220;<em>sRet</em>.&#8221;</p>



<p class="wp-block-paragraph">I used the following values:<br>
<em>PID_Compact.sRet.i_Mode<br>
PID_Compact.sRet.r_Ctrl_A<br>
PID_Compact.sRet.r_Ctrl_B<br>
PID_Compact.sRet.r_Ctrl_C<br>
PID_Compact.sRet.r_Ctrl_Gain<br>
PID_Compact.sRet.r_Ctrl_Td<br>
PID_Compact.sRet.r_Ctrl_Ti</em></p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="272" height="151" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/sRetContents.jpg" alt="sRetContents" class="wp-image-28756"/></figure>



<p class="wp-block-paragraph">There are pretty decent explanations (including a formula for how the output is determined) in the S7-1200 Easy Book for each parameter. You can also hover over each of the properties on the Advanced Settings page to get a short description and a link to the help file. One of the things that confused me initially was the <em>Ctrl_A</em>, <em>_B</em>, and <em>_C</em>, parameters, all three of which are 0 by default. You will most likely want to set <em>B </em>and <em>C </em>to 1 to enable traditional PID control.</p>



<p class="wp-block-paragraph">Finally, even after setting each of the gains, you will see that your PID block is still not functional. This is because you will need to manually set it into the correct operating mode. This is where <em>sRet.i_Mode</em>. This determines the mode into which the controller will go when it receives an enable command or comes out of manual control. You can set this to 3 (auto-mode) and then enable your controller, and you&#8217;re in business. While it takes a few minutes of exploring to familiarize yourself with the options, PID on an S7-1200 is pretty straightforward.</p>



<p class="wp-block-paragraph">While not full of a lot of detailed pointers, I hope this is helpful for you to at least picture the PID setup process. Good luck!</p>



<p class="wp-block-paragraph">Learn more about <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">DMC&#8217;s S7 PLC Programming</a>&nbsp;and&nbsp;<a href="https://static.dmcinfo.com/contact">contact us</a>&nbsp;to get started on your next PLC Programming project.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28757/pid-with-a-siemens-s7-1200-plc/">PID with a Siemens S7-1200 PLC</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Siemens S7-1200 Serial Communication</title>
		<link>https://static.dmcinfo.com/blog/28801/siemens-s7-1200-serial-communication/</link>
		
		<dc:creator><![CDATA[Jason Mayes]]></dc:creator>
		<pubDate>Wed, 15 Aug 2012 15:19:59 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/28801/siemens-s7-1200-serial-communication/</guid>

					<description><![CDATA[<p>Today, I found myself setting up some simple point-to-point serial communication on a Siemens S7-1200. For the current application, I was writing a simple&#160;function block to broadcast data to a Red Lion serial slave display, but there are a variety&#160;of situations in which you may need to do to this, such as communicating with a [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28801/siemens-s7-1200-serial-communication/">Siemens S7-1200 Serial Communication</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Today, I found myself setting up some simple point-to-point serial communication on a <a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens S7-1200</a>. For the current application, I was writing a simple&nbsp;function block to broadcast data to a <a href="http://www.redlion.net/Products/HumanMachineInterface/LargeDisplays/LDSS.html" target="_blank">Red Lion serial slave display</a>, but there are a variety&nbsp;of situations in which you may need to do to this, such as communicating with a VFD.&nbsp;While there are many people in this office who do this regularly with other Siemens PLCs, it was the first time for any of us on an S7-1200, so I thought I&#8217;d share my experience.</p>



<p class="wp-block-paragraph">First of all, if this is your first experience doing this, you&#8217;re in luck. Siemens (and Step 7) makes setting up basic point-to-point communication incredibly simple. The serial slave I was working with was incredibly flexible and accepts both RS-485 and RS-232. I happened to have a <a href="https://docs.tia.siemens.cloud/r/simatic_s7_1200_manual_collection_enus_20/technical-specifications/communication-interfaces/rs232-rs422-and-rs485/cm-1241-rs422/485-specifications" target="_blank" rel="noreferrer noopener">CM 1241 RS485</a> module on hand, so that&#8217;s what I used.</p>



<p class="wp-block-paragraph"><strong>Hardware Configuration:</strong></p>



<p class="wp-block-paragraph">The first step is to add the module itself to your device configuration. In Step 7, this is simple as opening up the device configuration device view and dragging the module to your PLC. Once you&#8217;ve added the module, a port identifier for the module&nbsp;will automatically be created. You can view the port number by selecting the module in your device view &#8211; you&#8217;re looking for the hardware identifier. Alternatively, there is a system constant tag created as well &#8211; you can find this under your Default Tag Table on the System Constants tab.</p>



<p class="wp-block-paragraph"><p style="text-align: center"><img decoding="async" alt="" height="289" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/DeviceConfig.jpg" width="450"></p></p>



<p class="wp-block-paragraph"><strong>Port Configuration:</strong></p>



<p class="wp-block-paragraph">The next step is to configure your port &#8211; set the baud rate, parity, stop bits, etc. Again, you can do all of this directly from the Device Configuration view by scrolling through the properties for the module. If you&#8217;d like to configure your port settings dynamically, no problem! There&#8217;s a simple function block provided (on the instructions palette, located under Communication) called PORT_CFG. This will allow you to fully define your port configuration as needed. I would suggest calling this block using the &#8220;FirstScan&#8221; bit (%M1.0) to make sure your settings are applied correctly every time the PLC starts.</p>



<p class="wp-block-paragraph"><p style="text-align: center"><img decoding="async" alt="" height="301" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/CommConfig.jpg" width="450"></p></p>



<p class="wp-block-paragraph"><strong>Sending Data:</strong></p>



<p class="wp-block-paragraph">Sending data is equally simple &#8211; just grab the SEND_PTP function block from the instruction set. In my case, I was broadcasting ASCII text to my slave display, so I wrote a quick function to convert a real to a string,&nbsp;concatenate it with&nbsp;my message header and terminator, and return the resulting string. To make things simple, I used the string length function block included in the extended instructions list to calculate the length of my string.</p>



<p class="wp-block-paragraph">That&#8217;s everything you need &#8211; send the data!</p>



<p class="wp-block-paragraph"><p style="text-align: center"><img decoding="async" alt="" height="252" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Send-Data.jpg" width="450"></p></p>



<p class="wp-block-paragraph"><strong>Receiving Data:</strong></p>



<p class="wp-block-paragraph">Receiving Data is just as simple. Use the RCV_PTP function block.</p>



<p class="wp-block-paragraph">That&#8217;s it! Serial communication is that simple. In fact, Siemens provides instructions for much more complicated communication protocols including blocks for configuring your port as Modbus master or slave, but that&#8217;s a little beyond my simple example here.</p>



<p class="wp-block-paragraph">Hope this is helpful! <a href="/contact">Contact us</a> for more information on our Siemens PLC Programming services.</p>



<p class="wp-block-paragraph"><strong><a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Learn more about DMC&#8217;s Siemens S7 PLC expertise</a>.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/28801/siemens-s7-1200-serial-communication/">Siemens S7-1200 Serial Communication</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Siemens vs Allen-Bradley: Function Blocks</title>
		<link>https://static.dmcinfo.com/blog/29940/siemens-vs-allen-bradley-function-blocks/</link>
		
		<dc:creator><![CDATA[Nick Shea]]></dc:creator>
		<pubDate>Wed, 17 Mar 2010 13:12:18 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Siemens PLC]]></category>
		<category><![CDATA[Function Blocks]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[Rockwell]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/29940/siemens-vs-allen-bradley-function-blocks/</guid>

					<description><![CDATA[<p>Siemens and Rockwell Automation are two giants competing in industrial automation technology today. Rockwell (aka Allen-Bradley) seems to be more popular in the US market, but Siemens has a larger international customer base. A cursory Google search will reveal that there is no lack of debate among automation professionals over which one is preferred. On [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/29940/siemens-vs-allen-bradley-function-blocks/">Siemens vs Allen-Bradley: Function Blocks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Siemens and Rockwell Automation are two giants competing in industrial automation technology today. Rockwell (aka Allen-Bradley) seems to be more popular in the US market, but Siemens has a larger international customer base. A cursory Google search will reveal that there is no lack of debate among automation professionals over which one is preferred.</p>



<p class="wp-block-paragraph">On the higher end of their PLC lines, the programming environments to use are:</p>



<ul class="wp-block-list">
<li><a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens &#8211; Step 7 Simatic Manager for S7-300 and 400 level PLCs</a></li>



<li><a href="/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Allen-Bradley (AB) &#8211; RSLogix 5000 for the Control Logix and Compact Logix PLCs</a></li>
</ul>



<p class="wp-block-paragraph">As someone who uses both platforms regularly, I would like to compare one of the key differences between them &#8211; function blocks.</p>



<h3 class="wp-block-heading" id="h-what-s-a-function-block">What&#8217;s a function block?</h3>



<p class="wp-block-paragraph">Siemens uses the term <strong>Function Block (FB)</strong> for program routines that can have internal memory, as opposed to Function Calls (FC) that have only temporary internal memory. Function blocks are a fundamental concept in the Siemens platform, which give them a significant advantage for large, modular applications.</p>



<p class="wp-block-paragraph">In AB’s RSLogix 5000 version 16 and higher, reusable function blocks are called <strong>Add-On Instructions (AOI)</strong> and can be defined with interface parameters and local tags. Since this feature was only added in 2007, it is often overlooked and doesn’t fit as seamlessly into the overall environment.</p>



<p class="wp-block-paragraph">Why use function blocks, you ask? You must read the DMC blog: &#8220;<a href="https://static.dmcinfo.com/blog/30127/iec-61131-3-function-blocks-unleash-the-power/">IEC 61131-3 Function Blocks &#8211; Unleash the Power!</a>&#8220;</p>



<p class="wp-block-paragraph">It is worth mentioning that both platforms adhere to the IEC-61131-3 standard, which means that function blocks are available and can be written in any of the standard&#8217;s languages.</p>



<h3 class="wp-block-heading" id="h-interfacing-to-an-instance-of-a-function-block">Interfacing to an instance of a function block</h3>



<p class="wp-block-paragraph">The way you interface to a function block is critical for program efficiency, readability, and development time. The point of a reusable function block is to wrap up complex or repetitive code and make a simple and easy to use interface in order to use that code. For example, when I visit a fast food drive-thru, I don’t need to tell them how to make a burger. They have made billions before mine. I just want to give my order, watch my burger come out the window, and then be on my way.</p>



<p class="wp-block-paragraph"><strong>In AB: Parameters in ladder have to be referenced independently from the function block call</strong></p>



<p class="wp-block-paragraph">If the function block instance is called in ladder, the input parameters can only be assigned with the block call if they are constants. Variable inputs must be assigned to input parameters in preceding ladder rungs. Outputs must be referenced in ladder rungs following the function block call. If calling the function block instance in FBD (function block diagram), then variables can be directly assigned to input and output parameters.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="758" height="533" src="https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Function-Block-Call.jpg.webp" alt="AB Function Block Call" class="wp-image-36069" srcset="https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Function-Block-Call.jpg.webp 758w, https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Function-Block-Call.jpg-300x211.webp 300w" sizes="(max-width: 758px) 100vw, 758px" /></figure>



<p class="wp-block-paragraph"><em>Disadvantage: More rungs of ladder to maintain. If called in FBD instead, then there are restrictions on instance declaration (see below) and simple Boolean logic is more complicated because you must use the FBD function boxes instead of contacts and coils.</em></p>



<p class="wp-block-paragraph"><strong>In Siemens: Parameters are directly interfaced in both ladder and FBD</strong></p>



<p class="wp-block-paragraph">Function block instances that are called in ladder and FBD are essentially the same. Even in ladder, variables can be assigned directly to input parameters. Boolean input parameters can also be assigned to the result of ladder logic operations. Function block outputs can be assigned directly to variables in the same rung of ladder.</p>



<p class="wp-block-paragraph">Note that function block input and output parameters can also be accessed symbolically from other rungs in ladder logic (just like the AB example above), but Siemens has the additional advantage of directly assigning input and output parameters in the same rung as the function block call.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="706" height="712" src="https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Function-Block-Call.jpg.webp" alt="Siemens Function Block Call" class="wp-image-36071" srcset="https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Function-Block-Call.jpg.webp 706w, https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Function-Block-Call.jpg-297x300.webp 297w, https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Function-Block-Call.jpg-150x150.webp 150w" sizes="(max-width: 706px) 100vw, 706px" /></figure>



<p class="wp-block-paragraph"><em>Advantage: All input and output parameter assignment for a function block instance can be consolidated in one rung and not spread out on separate rungs or throughout the program.</em></p>



<h3 class="wp-block-heading" id="h-declaring-an-instance-of-a-function-block">Declaring an instance of a function block</h3>



<p class="wp-block-paragraph"><strong>In AB: Limited to program tag file. If using FBD, cannot reside in a UDT</strong></p>



<p class="wp-block-paragraph">Instances of AOIs are most commonly declared in the “Program Tags” file of a program folder. Even for very modular programs, all function blocks are listed in this one common location. Instances can be declared within UDTs (user-defined types), but not if you want to use them in the FBD environment.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="759" height="387" src="https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Instance-Declaration.jpg.webp" alt="AB Instance Declaration" class="wp-image-36072" srcset="https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Instance-Declaration.jpg.webp 759w, https://static.dmcinfo.com/wp-content/uploads/2010/03/AB-Instance-Declaration.jpg-300x153.webp 300w" sizes="(max-width: 759px) 100vw, 759px" /></figure>



<p class="wp-block-paragraph"><em>Advantage: Simplicity. One location to look through for each program folder.</em></p>



<p class="wp-block-paragraph"><strong>In Siemens: Memory resides in an instance data block, but is declared within parent function blocks.</strong></p>



<p class="wp-block-paragraph">Most program logic, not just reusable logic, is located within function blocks. “Parent” function blocks are assigned an instance data block. All reusable function block instances can be declared within the parent function block’s static memory.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="757" height="565" src="https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Instance-Declaration.jpg.webp" alt="Siemens Instance Declaration" class="wp-image-36073" srcset="https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Instance-Declaration.jpg.webp 757w, https://static.dmcinfo.com/wp-content/uploads/2010/03/Siemens-Instance-Declaration.jpg-300x224.webp 300w" sizes="(max-width: 757px) 100vw, 757px" /></figure>



<p class="wp-block-paragraph"><em>Advantage: Modularity. Instances are declared within the function block that they are called.</em></p>



<h3 class="wp-block-heading" id="h-summary">Summary</h3>



<p class="wp-block-paragraph">In summary, Siemens seems to offer a little more flexibility in how function blocks are interfaced and instantiated. We have seen, however, that both Allen Bradley and Siemens offer solutions for reusable function blocks on their higher-end PLCs. Both Function Blocks in Siemens and Add-On Instructions in Allen Bradley will enhance the modularity and maintainability of your PLC program. <a href="/contact">Contact us</a> to get started on your next PLC Programming project.&nbsp;</p>



<p class="wp-block-paragraph"><strong>Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/plc-programming/siemens-s7-plc-programming">Siemens PLC</a> and <a href="/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Allen-Bradley PLC</a> programming expertise.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/29940/siemens-vs-allen-bradley-function-blocks/">Siemens vs Allen-Bradley: Function Blocks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
