<?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>Rockwell Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/rockwell/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Thu, 06 Aug 2026 20:08:30 +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>Rockwell Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>DMC Attended Rockwell&#8217;s ROKLive 2022</title>
		<link>https://static.dmcinfo.com/blog/18191/dmc-attended-rockwells-roklive-2022/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Thu, 13 Oct 2022 14:40:27 +0000</pubDate>
				<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PlantPAX]]></category>
		<category><![CDATA[Plex Systems]]></category>
		<category><![CDATA[Rockwell]]></category>
		<category><![CDATA[ROKLive]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/18191/dmc-attended-rockwells-roklive-2022/</guid>

					<description><![CDATA[<p>In June, DMC attended Rockwell’s ROKLive 2022, a three-day conference in Orlando, Florida where attendees learned about Rockwell’s plans for the upcoming year and their new products. Our engineers got the chance to participate in some demonstrations that let them get their hands on this new technology. Informational Sessions and Hands-on Demonstrations Elizabeth Hill Reed, [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/18191/dmc-attended-rockwells-roklive-2022/">DMC Attended Rockwell&#8217;s ROKLive 2022</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In June, DMC attended <a href="https://www.rockwellautomation.com/en-us/company/events/in-person-events/roklive.html">Rockwell’s ROKLive 2022</a>, a three-day conference in Orlando, Florida where attendees learned about <a href="https://www.rockwellautomation.com/en-us/company/about-us.html">Rockwell</a>’s plans for the upcoming year and their new products. Our engineers got the chance to participate in some demonstrations that let them get their hands on this new technology.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/PXL_20220613_163035122.jpg" alt="Rockwell's ROKLive Event 2022"/></figure>



<h2 class="wp-block-heading" id="h-informational-sessions-and-hands-on-demonstrations">Informational Sessions and Hands-on Demonstrations</h2>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/about/employee-bios/elizabeth-hill">Elizabeth Hill Reed</a>, one of the attendees, attended several info sessions to learn about Rockwell’s upcoming products, but she was most excited about their recent <a href="https://ir.rockwellautomation.com/press-releases/press-releases-details/2021/Rockwell-Automation-to-Expand-Industrial-Cloud-Software-Offering-with-Acquisition-of-Plex-Systems/default.aspx">merger with Plex Systems</a>.</p>



<p class="wp-block-paragraph">“Rockwell acquired Plex Systems to add to their stack of integrations,” Reed said. “They’re focusing, not only on having an automation layer with the PLC and HMI, but focusing on industry 4.0 and interconnectivity with having a system that can store all the data, analyze it, and give you a feedback loop to improve the process. They have an out-of-the-box MES platform that can be quickly spun up and provide value to clients a lot sooner, so you can use Plex to try out concepts quickly and then scale it out.”</p>



<p class="wp-block-paragraph">Reed believes that this merger will cause them to see more Plex Systems.</p>



<p class="wp-block-paragraph">“I think we&#8217;ll start to see more Plex Systems out there. It was interesting to see what it&#8217;s been used for in the past,” Reed said. “I’m more excited for how it&#8217;s going to scale out with the merger with Rockwell.”</p>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/about/employee-bios/keith-janson">Keith Janson</a>, another DMCer who attended the conference, focused more on Rockwell’s <a href="https://www.rockwellautomation.com/en-us/capabilities/process-solutions/process-systems/plantpax-distributed-control-system.html">Distributed Control System (DCS), PlantPAX</a> – something he’s excited to implement in future projects.</p>



<p class="wp-block-paragraph">“Rockwell’s product piggybacks off their PLC infrastructure – which is fairly unique for the industry,” Janson said. “It leverages itself nicely in the market as being a lower barrier to entry, but, from DMC&#8217;s perspective, it&#8217;s a lower barrier for us to operate in that space and to leverage those assets Rockwell puts out there. PlantPAX is something DMC could leverage and is an active focus we&#8217;re trying to implement. I’m really looking to build and expand our competency with it.”</p>



<p class="wp-block-paragraph">While they focused on different areas, what made both DMCers excited was Rockwell’s new <a href="https://www.rockwellautomation.com/en-us/products/software/factorytalk/designhub/optix.html">Optix</a> HMI; Janson and Reed got to get a sneak peek of the Optix software in a breakout session where Rockwell demonstrated the new functionality.</p>



<p class="wp-block-paragraph">“Getting to see [Optix] firsthand and&nbsp;what they were doing was one of the most interesting things for me,” Janson said. “[Rockwell] is going to a web-based solution which is where the rest of the industry is going. We were probably some of the first hands-on experience with it.”</p>



<h2 class="wp-block-heading" id="h-new-products-and-technologies">New Products and Technologies</h2>



<p class="wp-block-paragraph">Another highlight for Janson was learning more about containerized DCS solutions.</p>



<p class="wp-block-paragraph">“Something Rockwell had in place for a while is this concept of containerizing these implementations. Currently, the options for download are non-customizable, so — while you can download a Batch server or PASS server — there’s still quite a bit of configuration to get it integrated and up and running. The goal for the future is to get to the point where you essentially ‘build’ these machines in a wizard and it spits out a tailor-made solution,” Janson said.</p>



<p class="wp-block-paragraph">If he ever needs a batch server or an engineering workstation, Janson says she could essentially go to a Rockwell website and enter in the names and all the information to get one</p>



<p class="wp-block-paragraph">“It spits out those virtual machines, I throw them into the hypervisor, and we&#8217;re off to the races.&nbsp; It should be as close to plug-and-play as possible,” Janson said. “It&#8217;s not at that point now, but that&#8217;s the goal. That&#8217;s very exciting.”</p>



<h2 class="wp-block-heading" id="h-hello-orlando">Hello Orlando!</h2>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/PXL_20220614_004755661.jpg" alt="Rockwell's ROKLive Event 2022"/></figure>



<p class="wp-block-paragraph">While DMCers attended the conference during the day, they took the opportunity at night to explore the area around Universal Studios, which wasn’t far from the conference.</p>



<p class="wp-block-paragraph">“Keith and I went to dinner outside of the park every night,” Elizabeth said<a>. </a></p>



<p class="wp-block-paragraph">Meanwhile, Keith stayed an extra day to visit Universal Studios.</p>



<p class="wp-block-paragraph">&#8220;I went to Universal’s Islands of Adventures,&#8221; Janson said. &#8220;I was excited to try Hagrid’s Wonderful Creatures Motorcycle ride. Highly recommend!”</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/PXL_20220614_225631163.jpg" alt="Rockwell's ROKLive Event 2022 Robot"/></figure>



<p class="wp-block-paragraph"><em>Janson was greeted by this robot when exiting the elevator.</em></p>



<p class="wp-block-paragraph">Learn about DMC&#8217;s <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Rockwell Automation</a> expertise.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/18191/dmc-attended-rockwells-roklive-2022/">DMC Attended Rockwell&#8217;s ROKLive 2022</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Maximizing FactoryTalk View Site Edition Performance</title>
		<link>https://static.dmcinfo.com/blog/20445/maximizing-factorytalk-view-site-edition-performance/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 17 Dec 2019 13:03:25 +0000</pubDate>
				<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[FactoryTalk]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[Rockwell]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20445/maximizing-factorytalk-view-site-edition-performance/</guid>

					<description><![CDATA[<p>DMC recently helped a client maximize the visual performance and response of a FactoryTalk View Site Edition (FTV SE) Local Station application talking to a Micro850 PLC, and we have some tips and tricks to share for getting the most out of your FTV SE applications! Our application had some lag when loading new screens [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20445/maximizing-factorytalk-view-site-edition-performance/">Maximizing FactoryTalk View Site Edition Performance</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">DMC recently helped a client maximize the visual performance and response of a FactoryTalk View Site Edition (FTV SE) Local Station application talking to a Micro850 PLC, and we have some tips and tricks to share for getting the most out of your FTV SE applications!</p>

<p class="wp-block-paragraph">Our application had some lag when loading new screens because of the large amount of tags required to populate the screens. FTV SE can <a href="https://rockwellautomation.custhelp.com/app/answers/detail/a_id/607499">pull up to about 200 tags from a Micro 850 per second</a>; with larger PLC programs taking more time to send tags.</p>

<p class="wp-block-paragraph">For smaller HMI/PLC applications, all of the PLC tags from a Micro 850 can easily be pulled quickly while loading a screen. For larger applications, there may be some delay after opening a screen before all of the tags on a screen are loaded from the PLC and ready to populate their indicators.</p>

<p class="wp-block-paragraph">However, <a href="/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/rockwell-factorytalk">FactoryTalk</a> lets you load screens snappily, even when talking to smaller PLCs or when large amounts of data need to be loaded.</p>

<p class="wp-block-paragraph">A few tips and tricks are below!</p>

<ol class="wp-block-list">
 <li><strong>Decrease Maximum Tag Update Rate (per Screen)</strong> &#8211; This rate controls the shortest possible time it will take the FactoryTalk application to acquire or send a tag. This is important for buttons and indicators that need to have a fast&nbsp;response, as well as for loading screens quickly.

 <ol class="wp-block-list" style="list-style-type:lower-alpha">
  <li style="margin-bottom:10px; margin-top:10px;">To access this setting, right-click on a screen, select <strong>Display Settings</strong>, and under the <strong>Properties</strong> window, select the drop-down for <strong>Maximum Tag Update Rate</strong>. The default setting is 1 second; this may appear slow for most applications. A rate of 0.25 or 0.1 seconds will usually allow the screen to react without visible lag.<br />
  <img decoding="async" alt="max tag update" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Factory-talk-performance-step1_1.png"  /></li>
  <li style="margin-bottom:10px">This may have different levels of impact with different PLC platforms &#8211; this should be a good solution for fast performance with the Logix line of processors. We found that additional steps were needed with the smaller Micro800 line.</li>
  <li style="margin-bottom:10px">Keep in mind that your application may not be able to keep up with faster Tag Update Rate setpoints. This is dependent on the number of tags you have on the screen and the number of tags that are being fetched in the background (read on to learn more about background fetching!)</li>
 </ol>
 </li>
 <li><strong>Add Screen Caching</strong> &#8211; FactoryTalk View Site Edition&apos;s default behavior is to close any screens that aren&apos;t actively being displayed. This minimizes PC resource usage and allows you to edit screens in an active application (one of my favorite features). However, you can individually configure each screen to be cached, so that the screen is kept in memory even when it isn&apos;t shown on the screen. This greatly improves behavior for laggy screens.
 <ol class="wp-block-list" style="list-style-type:lower-alpha">
  <li style="margin-bottom:10px; margin-top:10px;">To access this setting, right-click on a screen, select <strong>Display Settings</strong>, and under the <strong>Properties</strong> window, choose <strong>Yes</strong> for <strong>Cache After Displaying</strong>.</li>
  <li style="margin-bottom:10px">You also have the option to select whether the screen is <strong>Always Updating</strong> or not. <strong>Always Updating</strong> is a good selection for screens that don&apos;t populate immediately even when cached &#8211; we found this was the best choice for most of our larger screens with lots of tags. Keep in mind that if the screen is Always Updating, it will always be polling tags from the PLC. This may influence the update rate of tags on other screens in your application.<br />
  <img decoding="async" alt="updating selection" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/factorytalk-performance-step2.png"  /></li>
 </ol>
 </li>
 <li style="Margin-botton:10px"><strong>Add Screen Pre-Caching</strong> &#8211; If Screen Caching improved your application&apos;s performance, you may also want to consider Pre-Caching your screens! Pre-Caching pre-loads the screens while the application is starting up, without displaying them on the PC. Cached screens without pre-caching&nbsp;may still be slow to load the first time they&apos;re displayed; pre-caching makes the display pull from an already cached screen the first time that it&apos;s loaded.
 <ol class="wp-block-list" style="list-style-type:lower-alpha">
  <li style="Margin-botton:10px; margin-top:10px;">This can be done via a Startup Macro. Create a macro in the <strong>Explorer</strong> pane under <strong>Logic and Control &gt; Macros</strong>. Right-click to create a <strong>New</strong> Macro.<br />
  <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/factorytalk-performance-step3.png"  /></li>
  <li style="Margin-botton:10px">In the Macro editor, add a call to the &quot;Display&quot; function for each screen that you&apos;d like to precache. Use the \Z flag to cache a screen <strong>without</strong> marking it as Always Updating. Use the \ZA flag to cache a screen and set the screen to Always Update. (A full description of this function and possible flags is available in the FTV help files as &quot;FactoryTalk View Site Edition Help &gt; FactoryTalk View commands &gt; Graphics commands &gt; Display&quot;)<br />
  <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/factorytalk-performance-step3B.png"  /></li>
  <li style="Margin-botton:10px">When launching or creating your FTV SE Client with the <strong>FactoryTalk View SE Client Wizard</strong>, include your macro as the <strong>Startup Macro</strong>.<br />
  <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/factorytalk-performance-step3C.png"  /></li>
 </ol>
 </li>
</ol>

<p class="wp-block-paragraph">If you follow these tips, you should have a fast and snappy HMI!</p>

<p class="wp-block-paragraph"><strong>Learn more about <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">DMC&apos;s Rockwell Programming Services.</a></strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20445/maximizing-factorytalk-view-site-edition-performance/">Maximizing FactoryTalk View Site Edition Performance</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Utilizing Tag-Based Alarms in Logix Designer</title>
		<link>https://static.dmcinfo.com/blog/20507/utilizing-tag-based-alarms-in-logix-designer/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Wed, 27 Nov 2019 08:13:08 +0000</pubDate>
				<category><![CDATA[Allen Bradley PLC]]></category>
		<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[Allen-Bradley]]></category>
		<category><![CDATA[Rockwell]]></category>
		<category><![CDATA[Safety]]></category>
		<category><![CDATA[Tag-Based Alarms]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20507/utilizing-tag-based-alarms-in-logix-designer/</guid>

					<description><![CDATA[<p>Whenever I create Add-On Instructions (AOIs) in RSLogix 5000 and Logix Designer, I make sure that they have their own alarm handling. However, this almost always requires some conditional logic and a timer. Now that Allen-Bradley has released the 5380 CompactLogix and the 5580 ControlLogix PLCs, though, I have started to rethink my programming strategy. [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20507/utilizing-tag-based-alarms-in-logix-designer/">Utilizing Tag-Based Alarms in Logix Designer</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Whenever I create Add-On Instructions (AOIs) in RSLogix 5000 and Logix Designer, I make sure that they have their own alarm handling. However, this almost always requires some conditional logic and a timer. Now that <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Allen-Bradley</a> has released the 5380 CompactLogix and the 5580 ControlLogix PLCs, though, I have started to rethink my programming strategy.</p>



<p class="wp-block-paragraph">With these newer models, you can easily create configurable tag-based alarms in Logix Designer, which can handle all the logic that was previously contained within the program&#8217;s ladder logic. This includes debounce timers, deadbands, and much more. Tag-based alarms also do not contribute to scan time like ALMA and ALMD instructions do, so it is advisable to use them if your PLC and firmware version permit it.</p>



<h2 class="wp-block-heading" id="h-adding-and-configuring-individual-alarms">Adding and Configuring Individual Alarms</h2>



<p class="wp-block-paragraph">To add a tag-based alarm for a specific single tag browse&nbsp;under the proper scope, right-click&nbsp;RealAlarm and select &#8220;Add Alarm for “[Tag Name].&#8221;</p>



<figure class="wp-block-image aligncenter size-full"><img fetchpriority="high" decoding="async" width="335" height="380" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ManuallyCreateAlarm_1.png" alt="Adding alarms for individual tags is incredibly easy and can done while browsing for tags ordinarily" class="wp-image-20494" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/ManuallyCreateAlarm_1.png 335w, https://static.dmcinfo.com/wp-content/uploads/2025/05/ManuallyCreateAlarm_1-264x300.png 264w" sizes="(max-width: 335px) 100vw, 335px" /></figure>



<p class="wp-block-paragraph">This menu should pop up next:&nbsp;</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="781" height="685" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmConfigurationMenu_1.png" alt="The alarm properties menu allows one to set many aspects of the behavior of their alarms that would ordinarily have to be contained within ladder logic and increase scan time" class="wp-image-20495" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmConfigurationMenu_1.png 781w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmConfigurationMenu_1-300x263.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmConfigurationMenu_1-768x674.png 768w" sizes="(max-width: 781px) 100vw, 781px" /></figure>



<p class="wp-block-paragraph">From here, you can configure the following properties:</p>



<ul class="wp-block-list">
<li><strong>Name:</strong> Set the name for the alarm as it will appear in the Logix Designer ‘Alarms’ page and the ‘Alarm Name’ column of the View Designer Alarm Summary object. Note:<strong> </strong>Alarm names do not have to be unique between two separate owners, but a single owner cannot have multiple alarms with the same name.</li>



<li><strong>Input: </strong>This is the tag associated with the alarm, which is triggered based on this tag&#8217;s value in relation to the defined expression.</li>



<li><strong>Condition:</strong> Here you use the &#8220;Expression&#8221; and &#8220;Limit&#8221; to determine the conditions under which the alarm is triggered. I’ve set it to trigger when the value of RealAlarm is more than, or equal to, 4800. The &#8220;Type&#8221; category is mostly&nbsp;just used for organization and clarity for operators.&nbsp;It will be displayed in the Condition&nbsp;column and&nbsp;does not affect the behavior of the alarm.</li>



<li><strong>On/Off Delay:</strong> Configure debounce timers for the alarm to trigger and deactivate respectively. Values are entered in milliseconds and must be divisible by 500.</li>



<li><strong>Deadband:</strong> This is the minimum difference between the input and trigger values that must be met before the alarm can be deactivated. For example, if I set my deadband to 300, then the input would have to fall to 4500 before the alarm can be turned off.</li>



<li><strong>Severity:</strong>&nbsp;Severity ranges from 1 to 1000 and higher values indicate more severe alarms. More severe alarms will be displayed more prominently in alarm-viewing objects and various icons will be used to indicate severity.</li>



<li><strong>Message:</strong> This is the message that will be displayed along with the alarm when activated. This can be a static message, or you can use the editor to tie tags to your message. This&nbsp;allows&nbsp;for a richer and more dynamic display of information&nbsp;(more on this later).</li>



<li><strong>Associated Tags: </strong>Here you can add up to four tags that are relevant to your alarm, which you can use&nbsp;in your message text.</li>



<li><strong>Shelving:</strong> Shelving is sort of like hitting the snooze button on your alarm. Here, you can set the shelve duration and&nbsp;the <em>maximum</em> duration for which it can be shelved.</li>
</ul>



<p class="wp-block-paragraph">To better demonstrate the functionality of the message editor and dynamic texts, let’s go through a quick example where I add an associated tag and integrate it into our message. To add an associated tag, hover over &#8220;Name&#8221;&nbsp;and click the button&nbsp;with an ellipsis.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="595" height="157" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AddAssocTag_1.png" alt="Adding associated tags can allow for more descriptive and dynamic alarm messages" class="wp-image-20496" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AddAssocTag_1.png 595w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AddAssocTag_1-300x79.png 300w" sizes="(max-width: 595px) 100vw, 595px" /></figure>



<p class="wp-block-paragraph">This menu should pop up:&nbsp;</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="502" height="402" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagMenu_1.png" alt="Browsing for associated tags is as simple as browsing for tags under any other circumstances. Note that you cannot use a udt or aoi. You must use a single tag contained within a larger structure." class="wp-image-20497" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagMenu_1.png 502w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagMenu_1-300x240.png 300w" sizes="(max-width: 502px) 100vw, 502px" /></figure>



<p class="wp-block-paragraph">Select the tag you would like to associate with your alarm. Once added,&nbsp;you’ll see it in the &#8220;Associated Tags&#8221;&nbsp;menu. For my example, I’ve added a bool that indicates when a valve&nbsp;to the tank is open.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="581" height="152" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagAdded_1.png" alt="Associated tags will appear within the selection menu. Remember that a max of only four tags may be added" class="wp-image-20498" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagAdded_1.png 581w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AssocTagAdded_1-300x78.png 300w" sizes="(max-width: 581px) 100vw, 581px" /></figure>



<p class="wp-block-paragraph">Additionally, you can create an entirely new tag and link it to your alarm by clicking the &#8220;New Tag&#8221; button in the alarm configuration menu. Now that we’ve added our associated tag, let’s use it in our alarm message. Click the button next to the message text box that says &#8220;Editor.&#8221;&nbsp;It should bring up a menu that looks like this:</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="596" height="336" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/MessageEditor_1.png" alt="Here I've configured a message that provides the current value of the input, the limit that triggers the alarm, and the status of a relevant valve" class="wp-image-20499" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/MessageEditor_1.png 596w, https://static.dmcinfo.com/wp-content/uploads/2025/05/MessageEditor_1-300x169.png 300w" sizes="(max-width: 596px) 100vw, 596px" /></figure>



<p class="wp-block-paragraph">Under the variable dropdown menu, you can select the alarm&#8217;s input, any associated tags, or other parameters related to the alarm—and then add them to your message by clicking&nbsp;&#8220;&lt;- Add.&#8221;&nbsp;I’ve set my alarm to display “Level Exceed High High Limit [Current Level] &gt;= [Configured Limit] Infeed Valve Open [Valve State].&#8221;&nbsp;This tells the user that the alarm is triggered, by how much the current value exceeds the alarm trigger value, and whether the infeed valve is open.&nbsp;As you can see, this editor allows for highly configurable and dynamic error messages to be set. Additionally, if someone were to change the limit that triggers the alarm, the message would update automatically.</p>



<p class="wp-block-paragraph">Once an alarm has been made and configured, you can edit it by going to the alarms page under &#8220;Alarm Manager&#8221;&nbsp;-&gt; &#8220;Alarms&#8221; in the controller organizer. You can also directly add alarms from this page by right-clicking anywhere and selecting &#8220;Add Alarm.&#8221;</p>



<p class="wp-block-paragraph">Below is an example photo of the alarm summary graphic in View Designer. Higher priority alarms are indicated by&nbsp;a red circle with two exclamation points.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="999" height="630" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSummary_1.png" alt="Studio 5000 View Designer's alarm summary tool is highly configurable and can provide info such as class, type, time of occurrence, severity, and message" class="wp-image-20500" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSummary_1.png 999w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSummary_1-300x189.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSummary_1-768x484.png 768w" sizes="(max-width: 999px) 100vw, 999px" /></figure>



<h2 class="wp-block-heading" id="h-adding-alarm-definitions">Adding Alarm Definitions</h2>



<p class="wp-block-paragraph">Oftentimes, adding individual alarms can be cumbersome because of the large volume&nbsp;your project requires. In this case, you can save a great deal of time by writing modularized code that makes use of user-defined types (UDTs) and AOIs&nbsp;<em>then </em>configuring alarm definitions based on these. An alarm definition is an alarm&nbsp;linked to the definition of an AOI or a defined datatype, such as a UDT. Whenever an AOI or a defined datatype is created, then alarms will be added for each alarm definition.</p>



<p class="wp-block-paragraph">There are some exceptions, however.&nbsp;When an InOut parameter, safety tag, or alias tag uses an AOI or a UDT with associated alarm definitions, then alarms will not be generated. This is because alarms are not supported on InOut parameters, safety tags, or alias tags.</p>



<p class="wp-block-paragraph">It should also be noted that you cannot create an alarm that’s directly linked to a tag from an instance of UDT or AOI. In other words, if you want to have an alarm tied to a tag in an AOI or UDT, then you need to either use an alarm definition or use a separate tag with the original tag&#8217;s value&nbsp;and use that for the alarm.</p>



<p class="wp-block-paragraph">To create alarm definitions, click on the corresponding tab in the controller organizer under &#8220;Alarm Manager&#8221;&nbsp;&gt; &#8220;Alarm Definitions.&#8221;&nbsp;Right-click anywhere within this window and select &#8220;Add Alarm Definition,&#8221;&nbsp;and it will bring up a menu nearly&nbsp;identical to the menu for configuring individual alarms:</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="780" height="684" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/NewAlarmDefinition_1.png" alt="The alarm definition menu is almost identical to the singular alarm property menu" class="wp-image-20501" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/NewAlarmDefinition_1.png 780w, https://static.dmcinfo.com/wp-content/uploads/2025/05/NewAlarmDefinition_1-300x263.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/NewAlarmDefinition_1-768x673.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></figure>



<p class="wp-block-paragraph">From here, you configure the alarms just like you did for the individual tag-based alarms, but&nbsp;with one slight difference. When you click the ellipsis button to assign an input, rather than choosing a specific tag instantiated in your program, you will select a tag from the definition of an AOI or a defined type. When selecting a tag from an AOI, only inputs and outputs to the AOI will be accessible—InOuts and local tags cannot be used here. The selection menu should&nbsp;look like this:</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="600" height="684" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/DefinitionTagSelection_1.png" alt="Selecting a tag for an alarm definition is easy. Just browse to the desired AOI or UDT and select a tag from it. Just remember that only inputs and outputs from AOIs can be used" class="wp-image-20502" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/DefinitionTagSelection_1.png 600w, https://static.dmcinfo.com/wp-content/uploads/2025/05/DefinitionTagSelection_1-263x300.png 263w" sizes="(max-width: 600px) 100vw, 600px" /></figure>



<p class="wp-block-paragraph">As an example, we’ll make a few alarm definitions using this SCP AOI. This AOI takes in pre-scale and post-scale min and max values, along with an input value to be processed, then scales and outputs that value accordingly. We call this AOI from inside our analog input processing AOI, so any instance of aoiDvc_AnalogInput will trigger the creation of these SCP alarms. Here’s what we have after making a few alarms for SCP’s output.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="1008" height="106" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmDefinitionExamples_1.png" alt="By taking the time to make these four simple alarms we'll now have a full set of alarms for every analog input in our project" class="wp-image-20503" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmDefinitionExamples_1.png 1008w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmDefinitionExamples_1-300x32.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmDefinitionExamples_1-768x81.png 768w" sizes="(max-width: 1008px) 100vw, 1008px" /></figure>



<p class="wp-block-paragraph">Now if we instantiate the SCP or aoiDvc_AnalogInput AOIs anywhere in the code, these four alarms will be created for each instance. As an example, I’ve added an aoiDvc_AnalogInput in the Controller Tags and Main Program Tags and an SCP instance in the Controller Tags. We get the following result on our Alarms page:</p>



<figure class="wp-block-image aligncenter size-large"><img decoding="async" width="1024" height="250" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/InstantiatedAlarms_1-1024x250.png" alt="Thanks to alarm definitions I've now got alarms for three analog input/scaling blocks created in completely different contexts" class="wp-image-20504" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/InstantiatedAlarms_1-1024x250.png 1024w, https://static.dmcinfo.com/wp-content/uploads/2025/05/InstantiatedAlarms_1-300x73.png 300w, https://static.dmcinfo.com/wp-content/uploads/2025/05/InstantiatedAlarms_1-768x187.png 768w, https://static.dmcinfo.com/wp-content/uploads/2025/05/InstantiatedAlarms_1.png 1147w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">(Note that because &#8220;Required&#8221;&nbsp;was not checked off in our alarm definition, the &#8220;Use&#8221;&nbsp;column is not checked off for any of the created alarms. Always remember to check off &#8220;Use&#8221;&nbsp;for any alarms&nbsp;you want active in your system.)</p>



<p class="wp-block-paragraph">Even though these alarms are all identical upon instantiation, we can still edit them after they’re created without affecting the alarm definition. For instance, maybe you want AI_2’s high alarm limit to be 80 instead of 90. Simply double-click the alarm and adjust the limit from the configuration menu.</p>



<p class="wp-block-paragraph">If you need to make changes to your alarm definition after you’ve created it, then you should be aware that changes to some properties, but not all, will be pushed to related instantiated alarms. Changes to the name, type, expression sign, message, and associated tags will be pushed to existing alarm instances. Changes to the limit, on and off delays, dead band, severity, and shelving durations will <strong><em>not</em></strong> be pushed to existing alarms and each alarm must be edited individually. Lastly, the input tag used for an alarm definition cannot be edited at all after creating the alarm definition.</p>



<h2 class="wp-block-heading" id="h-accessing-properties-of-alarms">Accessing Properties of Alarms</h2>



<p class="wp-block-paragraph">Another advantage of tag-based alarms is that many of the associated properties can be accessed from your program. This utility has many benefits&nbsp;like using your alarm’s status, fault state, or another property in your controls,&nbsp;or adjusting properties like the on/off delay, limit, or enabled/disabled state from the HMI. When planning out your program, it is important to remember that properties for tag-based alarms that are local within an AOI will not be accessible outside of that AOI’s logic. However, they will still be accessible from the HMI (provided they are configured for external access). The syntax for accessing these properties is as follow:</p>



<p class="has-text-align-center wp-block-paragraph">[Tag Name].@Alarms.[Alarm Name].[Property]</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="644" height="419" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmPropertyTags_1.png" alt="Alarm property tags are easy to work with although one should be aware that if the tag used to generate the alarm is a local tag or InOut to an AOI then these tags will not be accessible within the program." class="wp-image-20505" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmPropertyTags_1.png 644w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmPropertyTags_1-300x195.png 300w" sizes="(max-width: 644px) 100vw, 644px" /></figure>



<p class="wp-block-paragraph">If an owner has alarms that were generated via alarm definitions, then it will also have a set of properties related to its collection of alarms, like the number of unacknowledged alarms or the name and type of its highest severity alarm. For these properties, the syntax is as follows:</p>



<p class="has-text-align-center wp-block-paragraph">[Tag Name].@AlarmSet.[Property]</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="650" height="421" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSetPropertyTags_1.png" alt="@AlarmSet properties are accessed just like @Alarm properties but they only exist for alarms generated by alarm sets" class="wp-image-20506" srcset="https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSetPropertyTags_1.png 650w, https://static.dmcinfo.com/wp-content/uploads/2025/05/AlarmSetPropertyTags_1-300x194.png 300w" sizes="(max-width: 650px) 100vw, 650px" /></figure>



<h2 class="wp-block-heading" id="h-other-configurable-alarm-properties">Other Configurable Alarm Properties</h2>



<p class="wp-block-paragraph">So far, we have only discussed the items within the ‘General’ tab of the alarm configuration menu. There are still three tabs, which I&#8217;ll give a brief overview of:</p>



<p class="wp-block-paragraph">The <strong>&#8220;Class/Group&#8221;</strong>&nbsp;tab lets you define classes and groups for your alarms. These are mainly just used to help organize your alarms based on function, type of alarm, what piece of equipment the alarm is related to, or practically any categorization&nbsp;that fits your application. Classes and groups can help organize your&nbsp;alarms during both design and runtime.</p>



<p class="wp-block-paragraph">The <strong>&#8220;Advanced&#8221;</strong>&nbsp;tab allows you to configure some key properties that affect the behavior of your alarms. The &#8220;FactoryTalk View Command&#8221;&nbsp;is a command that is executed when someone selects the alarm on an alarm viewing graphic then clicks a button to execute the command.&nbsp;From this tab, you can also choose whether an alarm latches or requires acknowledgment before it will go away. For more on how to set these commands, I recommend checking out Rockwell&#8217;s guide to&nbsp;<a href="https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/ftae-rm001_-en-e.pdf">Alarm and Event Configuration</a></p>



<p class="wp-block-paragraph">From the <strong>&#8220;Status&#8221;</strong>&nbsp;tab you can see various statistics related to an alarm. Additionally,&nbsp;you can acknowledge, shelve, disable, or reset an alarm from Logix Designer.</p>



<h2 class="wp-block-heading" id="h-conclusion">Conclusion</h2>



<p class="wp-block-paragraph">Tag-based alarms can be an extremely useful tool to save you time programming and reduce the scan time of your program. However,&nbsp;there are a few key things to consider when implementing them:</p>



<ul class="wp-block-list">
<li>Tag-based alarms are only usable with newer models of PLCs. You’ll need at least firmware V31 and one of the following products:
<ul class="wp-block-list">
<li>Compact GuardLogic 5380</li>



<li>CompactLogix 5380</li>



<li>CompactLogix 5480</li>



<li>ControlLogix 5580</li>



<li>GuardLogix 5580</li>
</ul>
</li>



<li>Alarm-definition alarms will not be created for InOut parameters, safety tags, or alias tags.</li>



<li>When making alarm definitions for an AOI, only inputs and outputs can be tied to alarms.
<ul class="wp-block-list">
<li>InOuts and local tags will not be accessible for use as the alarm input</li>
</ul>
</li>



<li>Tag-based alarms cannot be configured for an individual component tag of an AOI or UDT.
<ul class="wp-block-list">
<li>You must create an alarm definition for the AOI or UDT</li>
</ul>
</li>



<li>The properties of tag-based alarms can be read and written in your program and HMI, provided external access has been set appropriately.</li>
</ul>



<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/allen-bradley-plc-programming">Rockwell PLC</a> and <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/rockwell-factorytalk">HMI programming</a> expertise and <a href="https://static.dmcinfo.com/contact">contact us</a> to get started on your next project.&nbsp;</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20507/utilizing-tag-based-alarms-in-logix-designer/">Utilizing Tag-Based Alarms in Logix Designer</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Writing Rockwell Ladder Logic in XML</title>
		<link>https://static.dmcinfo.com/blog/21432/writing-rockwell-ladder-logic-in-xml/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Fri, 07 Jun 2019 11:54:26 +0000</pubDate>
				<category><![CDATA[Allen Bradley PLC]]></category>
		<category><![CDATA[Denver]]></category>
		<category><![CDATA[.L5X]]></category>
		<category><![CDATA[Rockwell]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21432/writing-rockwell-ladder-logic-in-xml/</guid>

					<description><![CDATA[<p>Have you ever been coding the same thing over and over again, and thought “man, there must be an easier way to do this!” Well, I have. And luckily, so has Rockwell! The XML import feature allows you to generate repeat code with ease.&#160; In this blog, I’ll walk you through writing XML code to [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21432/writing-rockwell-ladder-logic-in-xml/">Writing Rockwell Ladder Logic in XML</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Have you ever been coding the same thing over and over again, and thought “man, there must be an easier way to do this!” Well, I have. And luckily, so has Rockwell! The XML import feature allows you to generate repeat code with ease.&nbsp;</p>



<p class="wp-block-paragraph">In this blog, I’ll walk you through writing <strong>XML code</strong> to generate <strong>ladder logic in Rockwell</strong>. Using these techniques, you can write scripts, macros, and other tools to create .L5X files that can be directly imported into your Rockwell program. You can create data types, tags, rungs, routines, or even entire programs, all from your favorite text-based program.</p>



<p class="wp-block-paragraph">To see how this technique can be used to buffer IO, <a href="https://static.dmcinfo.com/latest-thinking/blog/id/9856/generating-buffering-routines-on-an-allen-bradley-plc-using-excel-macros">check out Brandon&#8217;s Blog!</a></p>



<p class="wp-block-paragraph">To start, let&#8217;s look at the bare bones of a .L5X file and the required structure. It has a nested structure, with the controller at the highest level and rung content at the lowest. In order for Studio 5000 to recognize the file, you must keep this structure. In this example, I&#8217;ll write a &#8220;rung&#8221; import file, but it&#8217;s easy to adapt to generate routines or entire programs.&nbsp;</p>



<p class="wp-block-paragraph">Here&#8217;s a skeleton of a .L5X file:</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;?xml version="1.0" encoding="UTF-8" standalone="yes"?>

&lt;RSLogix5000Content
    SchemaRevision="1.0"
    SoftwareRevision="28.00"
    TargetType="Rung"
    TargetCount="1"
    ContainsContext="true"
    Owner="DMC"
    ExportDate="Mon May 20 15:46:14 2019"
    ExportOptions="
        References
        NoRawData
        L5KData
        DecoratedData
        Context
        Dependencies
        ForceProtectedEncoding
        AllProjDocTrans">

    &lt;Controller Use="Context">

        &lt;DataTypes Use="Context">
        &lt;/DataTypes>

        &lt;Tags Use="Context">
        &lt;/Tags>

        &lt;Programs Use="Context">

            &lt;Program Use="Context">

                &lt;Routines Use="Context">

                    &lt;Routine Use="Context">

                        &lt;RLLContent Use="Context">
                        &lt;/RLLContent>

                    &lt;/Routine>

                &lt;/Routines>

            &lt;/Program>

        &lt;/Programs>

    &lt;/Controller>

&lt;/RSLogix5000Content></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">xml</span><span style="color: #9CDCFE"> version</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1.0&quot;</span><span style="color: #9CDCFE"> encoding</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;UTF-8&quot;</span><span style="color: #9CDCFE"> standalone</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;yes&quot;</span><span style="color: #808080">?&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">RSLogix5000Content</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">SchemaRevision</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1.0&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">SoftwareRevision</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;28.00&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">TargetType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Rung&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">TargetCount</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ContainsContext</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">Owner</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;DMC&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ExportDate</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Mon May 20 15:46:14 2019&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ExportOptions</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;</span></span>
<span class="line"><span style="color: #CE9178">        References</span></span>
<span class="line"><span style="color: #CE9178">        NoRawData</span></span>
<span class="line"><span style="color: #CE9178">        L5KData</span></span>
<span class="line"><span style="color: #CE9178">        DecoratedData</span></span>
<span class="line"><span style="color: #CE9178">        Context</span></span>
<span class="line"><span style="color: #CE9178">        Dependencies</span></span>
<span class="line"><span style="color: #CE9178">        ForceProtectedEncoding</span></span>
<span class="line"><span style="color: #CE9178">        AllProjDocTrans&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Controller</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataTypes</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">DataTypes</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Tags</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">Tags</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Programs</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Program</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Routines</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Routine</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">RLLContent</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">RLLContent</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Routine</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Routines</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Program</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Programs</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Controller</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">RSLogix5000Content</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">Let&#8217;s use this skeleton to create a simple rung to turn on the red light if the red button is pressed. While this is clearly overkilled for this one rung, it would be very useful if you had 100 button/light combinations.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/goal-rung-blog.png" alt="Goal rung to generate in XML. "/></figure>



<p class="wp-block-paragraph">We&#8217;ll need to add code for the tags, the rung logic, and the rung comment. First, let&#8217;s create the two boolean tags used in this rung. Between the lines <code>&lt;Tags Use="Context"> </code>and <code>&lt;/Tags></code>, insert the following lines. These tell the import tool to make new tags of type bool with the proper names. The line <code>&lt;![CDATA[0]]&gt; </code>sets the initial value of the tag to 0. I often use this feature to initialize values of a user defined type.</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;Tag Name="bInRedButtonPressed" TagType="Base" DataType="BOOL" Radix="Decimal" Constant="false" ExternalAccess="Read/Write">
&lt;Data Format="L5K">
&lt;![CDATA&#91;0&#93;]>
&lt;/Data>
&lt;Data Format="Decorated">
&lt;DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
&lt;/Data>
&lt;/Tag>
&lt;Tag Name="bOutRedLightOn" TagType="Base" DataType="BOOL" Radix="Decimal" Constant="false" ExternalAccess="Read/Write">
&lt;Data Format="L5K">
&lt;![CDATA&#91;0&#93;]>
&lt;/Data>
&lt;Data Format="Decorated">
&lt;DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
&lt;/Data>
&lt;/Tag></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">Tag</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInRedButtonPressed&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">TagType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Base&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">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Constant</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;false&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ExternalAccess</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Read/Write&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;L5K&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #CE9178">&lt;![CDATA&#91;0&#93;]&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decorated&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataValue</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">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Value</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: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Tag</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Tag</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutRedLightOn&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">TagType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Base&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">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Constant</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;false&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ExternalAccess</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Read/Write&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;L5K&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #CE9178">&lt;![CDATA&#91;0&#93;]&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decorated&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataValue</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">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Value</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: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Tag</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">You can continue to add more tags as needed, change their properties, and their initial values. Next, let&#8217;s add logic for the rung. Between<code> the lines &lt;RLLContent Use="Context"></code> and <code>&lt;/RLLContent></code>, add the following lines.</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;Rung Use="Target" Number="1" Type="N">

    &lt;Comment>
        &lt;![CDATA&#91;
        Turn on the Red Light when the Red Button is pressed.
        &#93;]>
    &lt;/Comment>

    &lt;Text>
        &lt;![CDATA&#91;
        XIC(bInRedButtonPressed) OTE(bOutRedLightOn);
        &#93;]>
    &lt;/Text>

&lt;/Rung></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">Rung</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Target&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;N&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></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: #CE9178">&lt;![CDATA&#91;</span></span>
<span class="line"><span style="color: #CE9178">        Turn on the Red Light when the Red Button is pressed.</span></span>
<span class="line"><span style="color: #CE9178">        &#93;]&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>
<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>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&lt;![CDATA&#91;</span></span>
<span class="line"><span style="color: #CE9178">        XIC(bInRedButtonPressed) OTE(bOutRedLightOn);</span></span>
<span class="line"><span style="color: #CE9178">        &#93;]&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>
<span class="line"></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Rung</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The <strong>&#8220;text&#8221;</strong> section is where you add the code for your rung. For something simple like this, it&#8217;s fairly easy to do (just XIC and OTE instructions). However, if you&#8217;re unsure of the &#8220;text version&#8221; of your ladder logic, just double click on the rung number in the ladder editor, and it will display the text.</p>



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



<p class="wp-block-paragraph">And that&#8217;s all you need to do! You can add more rungs just by repeating the pattern. Be sure to edit the <code>targetcount </code>on line 2 to match the number of rungs you&#8217;re making. Save the file with a .L5X extension and import it directly into your routine!</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;?xml version="1.0" encoding="UTF-8" standalone="yes"?>

&lt;RSLogix5000Content
    SchemaRevision="1.0"
    SoftwareRevision="28.00"
    TargetType="Rung"
    TargetCount="1"
    ContainsContext="true"
    Owner="DMC"
    ExportDate="Mon May 20 15:46:14 2019">

    &lt;Controller Use="Context">

        &lt;DataTypes Use="Context">
        &lt;/DataTypes>

        &lt;Tags Use="Context">

            &lt;Tag
                Name="bInRedButtonPressed"
                TagType="Base"
                DataType="BOOL"
                Radix="Decimal"
                Constant="false"
                ExternalAccess="Read/Write">

                &lt;Data Format="L5K">&lt;![CDATA&#91;0&#93;]>&lt;/Data>

                &lt;Data Format="Decorated">
                    &lt;DataValue
                        DataType="BOOL"
                        Radix="Decimal"
                        Value="0"/>
                &lt;/Data>
            &lt;/Tag>

            &lt;Tag
                Name="bOutRedLightOn"
                TagType="Base"
                DataType="BOOL"
                Radix="Decimal"
                Constant="false"
                ExternalAccess="Read/Write">

                &lt;Data Format="L5K">&lt;![CDATA&#91;0&#93;]>&lt;/Data>

                &lt;Data Format="Decorated">
                    &lt;DataValue
                        DataType="BOOL"
                        Radix="Decimal"
                        Value="0"/>
                &lt;/Data>
            &lt;/Tag>

        &lt;/Tags>

        &lt;Programs Use="Context">
            &lt;Program Use="Context">

                &lt;Routines Use="Context">
                    &lt;Routine Use="Context">

                        &lt;RLLContent Use="Context">

                            &lt;Rung Use="Target"
                                  Number="1"
                                  Type="N">

                                &lt;Comment>
                                    &lt;![CDATA&#91;
                                    Turn on the Red Light when the Red Button is pressed.
                                    &#93;]>
                                &lt;/Comment>

                                &lt;Text>
                                    &lt;![CDATA&#91;
                                    XIC(bInRedButtonPressed)
                                    OTE(bOutRedLightOn);
                                    &#93;]>
                                &lt;/Text>

                            &lt;/Rung>

                        &lt;/RLLContent>

                    &lt;/Routine>
                &lt;/Routines>

            &lt;/Program>
        &lt;/Programs>

    &lt;/Controller>

&lt;/RSLogix5000Content></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">xml</span><span style="color: #9CDCFE"> version</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1.0&quot;</span><span style="color: #9CDCFE"> encoding</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;UTF-8&quot;</span><span style="color: #9CDCFE"> standalone</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;yes&quot;</span><span style="color: #808080">?&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">RSLogix5000Content</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">SchemaRevision</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1.0&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">SoftwareRevision</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;28.00&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">TargetType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Rung&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">TargetCount</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ContainsContext</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;true&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">Owner</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;DMC&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ExportDate</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Mon May 20 15:46:14 2019&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Controller</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">DataTypes</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">DataTypes</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Tags</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Tag</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bInRedButtonPressed&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">TagType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Base&quot;</span></span>
<span class="line"><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>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Constant</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;false&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">ExternalAccess</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Read/Write&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;L5K&quot;</span><span style="color: #808080">&gt;</span><span style="color: #CE9178">&lt;![CDATA&#91;0&#93;]&gt;</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decorated&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">DataValue</span></span>
<span class="line"><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>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #9CDCFE">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #9CDCFE">Value</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">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Tag</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Tag</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Name</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;bOutRedLightOn&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">TagType</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Base&quot;</span></span>
<span class="line"><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>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">Constant</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;false&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #9CDCFE">ExternalAccess</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Read/Write&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;L5K&quot;</span><span style="color: #808080">&gt;</span><span style="color: #CE9178">&lt;![CDATA&#91;0&#93;]&gt;</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Data</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Format</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decorated&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">DataValue</span></span>
<span class="line"><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>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #9CDCFE">Radix</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Decimal&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #9CDCFE">Value</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">Data</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Tag</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Tags</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Programs</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">Program</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Routines</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&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">Routine</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">RLLContent</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Context&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">Rung</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">Use</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;Target&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                                  </span><span style="color: #9CDCFE">Number</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;1&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">                                  </span><span style="color: #9CDCFE">Type</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;N&quot;</span><span style="color: #808080">&gt;</span></span>
<span class="line"></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: #CE9178">&lt;![CDATA&#91;</span></span>
<span class="line"><span style="color: #CE9178">                                    Turn on the Red Light when the Red Button is pressed.</span></span>
<span class="line"><span style="color: #CE9178">                                    &#93;]&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>
<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>
<span class="line"><span style="color: #D4D4D4">                                    </span><span style="color: #CE9178">&lt;![CDATA&#91;</span></span>
<span class="line"><span style="color: #CE9178">                                    XIC(bInRedButtonPressed)</span></span>
<span class="line"><span style="color: #CE9178">                                    OTE(bOutRedLightOn);</span></span>
<span class="line"><span style="color: #CE9178">                                    &#93;]&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>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Rung</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">RLLContent</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">                    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Routine</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">                </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Routines</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Program</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Programs</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">Controller</span><span style="color: #808080">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">RSLogix5000Content</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">This blog was inspired by a new Excel tool I wrote to help us write sequences for one of our large Oil and Gas clients. These sequences were often very similar, so having a tool to auto-generate them made a lot of sense. Our engineers can now fill out the system parameters in Excel, and a macro generates all the rungs and data required for the program.</p>



<p class="wp-block-paragraph">What used to take us a few hours can now be done in a matter of minutes!&nbsp;You can learn more about the project and the customer benefits here.</p>



<p class="wp-block-paragraph">If you need help with <a href="https://static.dmcinfo.com/latest-thinking/blog/articletype/categoryview/categoryid/58/allen-bradley-plc">Rockwell Programming</a>&nbsp;or any other automation tasks, <a href="https://static.dmcinfo.com/contact">let us know</a>!</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21432/writing-rockwell-ladder-logic-in-xml/">Writing Rockwell Ladder Logic in XML</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Generating Buffering Routines on an Allen Bradley PLC Using Excel Macros</title>
		<link>https://static.dmcinfo.com/blog/21783/generating-buffering-routines-on-an-allen-bradley-plc-using-excel-macros/</link>
		
		<dc:creator><![CDATA[Brandon Tanner]]></dc:creator>
		<pubDate>Wed, 03 Apr 2019 13:29:00 +0000</pubDate>
				<category><![CDATA[Allen Bradley PLC]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[Rockwell]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21783/generating-buffering-routines-on-an-allen-bradley-plc-using-excel-macros/</guid>

					<description><![CDATA[<p>Allen Bradley PLC’s, both in RSLogix5000 and Studio5000, use a text-based language to assemble their ladder code. Each rung of contacts and coils can be translated to a line of code. This is a unique feature that gives the user several benefits. One of these is that each part of the project can be exported [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21783/generating-buffering-routines-on-an-allen-bradley-plc-using-excel-macros/">Generating Buffering Routines on an Allen Bradley PLC Using Excel Macros</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="/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Allen Bradley PLC’s</a>, both in RSLogix5000 and Studio5000, use a text-based language to assemble their ladder code. Each rung of contacts and coils can be translated to a line of code. This is a unique feature that gives the user several benefits. One of these is that each part of the project can be exported into a simple text file and then reimported into another project. This eliminates the issues of version numbers of code compatibility.</p>



<p class="wp-block-paragraph">Beyond just allowing for code to be exported and imported between projects or Rockwell editors, it also allows for external code generation. In fact, a whole project could be created using a text editor and then imported into RSLogix5000 or Studio5000. While this might not be a practical method of creating an entire project, the ability to generate text-based code has several benefits.</p>



<p class="wp-block-paragraph">In a recent project, DMC used an Excel Macro to generate the buffering routines for an Allen Bradley project. Rather than manually creating an input routine for each of the hundreds of tags, in one click, a simple Macro generated files that could be imported into Rockwell.</p>



<p class="wp-block-paragraph">In the following example, we will work with a simple program that has three inputs and outputs as shown in Figure1. This information can easily be compiled from the wiring info or electrical schematics.</p>



<p class="wp-block-paragraph"><p style="font-style: italic;"><span style="font-size:x-small;">Figure 1: List of IO Information</span></p></p>



<p class="wp-block-paragraph">Rockwell’s text-based code is saved in a file format with an L5X extension. However, this is just a .txt file with a different extension. From Rockwell, you can export a routine, and if you open the L5X file with a text editor, you can see how the code translates to text.</p>



<h2 class="wp-block-heading" id="h-generating-the-text-file">Generating the Text File</h2>



<p class="wp-block-paragraph">One of the easiest ways to generate a text file from Excel is to use a Macro written in VBScript. Open the <strong>Visual Basic editor</strong> from the <strong>Developer tab</strong> to bring up the VBScript editor.</p>



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



<p class="wp-block-paragraph">In the Visual Basics editor, we will create a new module. Right click on the excel document that you are using and insert a new module. Each module acts like a function.</p>



<p class="wp-block-paragraph">As your code gets more complicated, subfunctions can be separated to make the code more modular. For our purpose, the code is simple enough that we will only need one module.</p>



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



<pre class="wp-block-code"><code>
Sub CreateBufferingFiles()

End Sub

</code></pre>



<p class="wp-block-paragraph">As mentioned, the first thing to do in our macro is to generate our files. VBScript uses a helper object to create the actual file. Next, we create our file through our file path string. This can be changed to whatever location you want the file to end up. Then, we create our file as a text file.</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">VBA</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>'Create File
Dim fso As Object
    	Set fso = CreateObject("Scripting.FileSystemObject")


Dim myInputFilePath As String
	myInputFilePath = "C:\Documents\ExampleProject\MapInputs.L5X"
Dim myInputFile As Object
Set myInputFile = fso.createTextFile(myInputFilePath)
    	
Dim myOutputFilePath As String
    	myOutputFilePath = "C:\Docuements\ExampleProject\MapOutputs.L5X"
	Dim myOutputFile As Object
	Set myOutputFile = fso.createTextFile(myOutputFilePath)</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: #6A9955">&apos;Create File</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> fso </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Object</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">	Set </span><span style="color: #9CDCFE">fso</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">CreateObject</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Scripting.FileSystemObject&quot;</span><span style="color: #D4D4D4">)</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> myInputFilePath </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #9CDCFE">myInputFilePath</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;C:\Documents\ExampleProject\MapInputs.L5X&quot;</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> myInputFile </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Object</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">myInputFile</span><span style="color: #D4D4D4"> = fso.</span><span style="color: #DCDCAA">createTextFile</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">myInputFilePath</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">    	</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> myOutputFilePath </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span></span>
<span class="line"><span style="color: #D4D4D4">    	</span><span style="color: #9CDCFE">myOutputFilePath</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;C:\Docuements\ExampleProject\MapOutputs.L5X&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> myOutputFile </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Object</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">myOutputFile</span><span style="color: #D4D4D4"> = fso.</span><span style="color: #DCDCAA">createTextFile</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">myOutputFilePath</span><span style="color: #D4D4D4">)</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-creating-lines-of-code">Creating Lines of Code</h2>



<p class="wp-block-paragraph">Once we have created our file, we can use the <strong>writeLine</strong> command to create lines of code. The first thing we need to create is the header information for the device. This specifies the version number, PLC name, and scope of things in the project. This information doesn’t need to match exactly since we can import directly to a program, but the formatting needs to be consistent.</p>



<p class="wp-block-paragraph">The easiest way is to export a file and then copy the header lines into our VBScript, add the object.writeLine command and then format it to be a string. The program below would be an example of a way to create header information. This would need to be done for <strong>both</strong> the input and output mapping routines.</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">VBA</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>‘======================================== Input ===============================
‘Input Mapping Header
'Create Header Information
myInputFile.writeLine "&lt;?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
myInputFile.writeLine "&lt;RSLogix5000Content SchemaRevision=""1.0"" SoftwareRevision=""31.00"" TargetName=""State_RunOut"" TargetType=""Routine"" TargetSubType=""RLL"" ContainsContext=""true"" Owner=""AB-Rockwell, DMC"" ExportDate=""Thu Dec 06 14:42:07 2018"" ExportOptions=""References NoRawData L5KData DecoratedData Context Dependencies ForceProtectedEncoding AllProjDocTrans"">"
myInputFile.writeLine "&lt;Controller Use=""Context"" Name=""TigrisThermalSystems"">"
    
 'Begin Controller scope rungs and tags
 myInputFile.writeLine "&lt;Programs Use=""Context"">"
 myInputFile.writeLine "&lt;Program Use=""Context"" Name=""HydronicLoop"">"
  
 'Create Controller Tags
    
 'Create rungs
 myInputFile.writeLine "&lt;Routines Use=""Context"">"
 myInputFile.writeLine "&lt;Routine Use=""Target"" Name=""MapInputs"" Type=""RLL"">"
 myInputFile.writeLine "&lt;RLLContent>"</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: #D4D4D4">‘========================================</span><span style="color: #9CDCFE"> Input</span><span style="color: #D4D4D4"> ===============================</span></span>
<span class="line"><span style="color: #D4D4D4">‘Input Mapping Header</span></span>
<span class="line"><span style="color: #6A9955">&apos;Create Header Information</span></span>
<span class="line"><span style="color: #D4D4D4">myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;?xml version=&quot;&quot;1.0&quot;&quot; encoding=&quot;&quot;UTF-8&quot;&quot; standalone=&quot;&quot;yes&quot;&quot;?&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;RSLogix5000Content SchemaRevision=&quot;&quot;1.0&quot;&quot; SoftwareRevision=&quot;&quot;31.00&quot;&quot; TargetName=&quot;&quot;State_RunOut&quot;&quot; TargetType=&quot;&quot;Routine&quot;&quot; TargetSubType=&quot;&quot;RLL&quot;&quot; ContainsContext=&quot;&quot;true&quot;&quot; Owner=&quot;&quot;AB-Rockwell, DMC&quot;&quot; ExportDate=&quot;&quot;Thu Dec 06 14:42:07 2018&quot;&quot; ExportOptions=&quot;&quot;References NoRawData L5KData DecoratedData Context Dependencies ForceProtectedEncoding AllProjDocTrans&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Controller Use=&quot;&quot;Context&quot;&quot; Name=&quot;&quot;TigrisThermalSystems&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Begin Controller scope rungs and tags</span></span>
<span class="line"><span style="color: #D4D4D4"> myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Programs Use=&quot;&quot;Context&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Program Use=&quot;&quot;Context&quot;&quot; Name=&quot;&quot;HydronicLoop&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Create Controller Tags</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Create rungs</span></span>
<span class="line"><span style="color: #D4D4D4"> myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Routines Use=&quot;&quot;Context&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Routine Use=&quot;&quot;Target&quot;&quot; Name=&quot;&quot;MapInputs&quot;&quot; Type=&quot;&quot;RLL&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;RLLContent&gt;&quot;</span></span></code></pre></div>



<p class="wp-block-paragraph"><strong>And for the Output:</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">VBA</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>	‘======================================== Output ===============================
‘Output Mapping Header
'Create Header Information
myOutputFile.writeLine "&lt;?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
myOutputFile.writeLine "&lt;RSLogix5000Content SchemaRevision=""1.0"" SoftwareRevision=""31.00"" TargetName=""State_RunOut"" TargetType=""Routine"" TargetSubType=""RLL"" ContainsContext=""true"" Owner=""AB-Rockwell, DMC"" ExportDate=""Thu Dec 06 14:42:07 2018"" ExportOptions=""References NoRawData L5KData DecoratedData Context Dependencies ForceProtectedEncoding AllProjDocTrans"">"
myOutputFile.writeLine "&lt;Controller Use=""Context"" Name=""TigrisThermalSystems"">"
    
 'Begin Controller scope rungs and tags
 myOutputFile.writeLine "&lt;Programs Use=""Context"">"
 myOutputFile.writeLine "&lt;Program Use=""Context"" Name=""HydronicLoop"">"
  
 'Create Controller Tags
    
 'Create rungs
 myOutputFile.writeLine "&lt;Routines Use=""Context"">"
 myOutputFile.writeLine "&lt;Routine Use=""Target"" Name=""MapOutputs"" Type=""RLL"">"
 myOutputFile.writeLine "&lt;RLLContent>"</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: #D4D4D4">	‘========================================</span><span style="color: #9CDCFE"> Output</span><span style="color: #D4D4D4"> ===============================</span></span>
<span class="line"><span style="color: #D4D4D4">‘Output Mapping Header</span></span>
<span class="line"><span style="color: #6A9955">&apos;Create Header Information</span></span>
<span class="line"><span style="color: #D4D4D4">myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;?xml version=&quot;&quot;1.0&quot;&quot; encoding=&quot;&quot;UTF-8&quot;&quot; standalone=&quot;&quot;yes&quot;&quot;?&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;RSLogix5000Content SchemaRevision=&quot;&quot;1.0&quot;&quot; SoftwareRevision=&quot;&quot;31.00&quot;&quot; TargetName=&quot;&quot;State_RunOut&quot;&quot; TargetType=&quot;&quot;Routine&quot;&quot; TargetSubType=&quot;&quot;RLL&quot;&quot; ContainsContext=&quot;&quot;true&quot;&quot; Owner=&quot;&quot;AB-Rockwell, DMC&quot;&quot; ExportDate=&quot;&quot;Thu Dec 06 14:42:07 2018&quot;&quot; ExportOptions=&quot;&quot;References NoRawData L5KData DecoratedData Context Dependencies ForceProtectedEncoding AllProjDocTrans&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Controller Use=&quot;&quot;Context&quot;&quot; Name=&quot;&quot;TigrisThermalSystems&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Begin Controller scope rungs and tags</span></span>
<span class="line"><span style="color: #D4D4D4"> myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Programs Use=&quot;&quot;Context&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Program Use=&quot;&quot;Context&quot;&quot; Name=&quot;&quot;HydronicLoop&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">  </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Create Controller Tags</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Create rungs</span></span>
<span class="line"><span style="color: #D4D4D4"> myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Routines Use=&quot;&quot;Context&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Routine Use=&quot;&quot;Target&quot;&quot; Name=&quot;&quot;MapOutputs&quot;&quot; Type=&quot;&quot;RLL&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4"> myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;RLLContent&gt;&quot;</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-setting-up-the-worksheet">Setting Up the Worksheet</h2>



<p class="wp-block-paragraph">Once we have created the header info, we can set up the information that will go through the worksheet and create a rung for each tag. This loop looks at the value of the first column and continues until it finds a blank cell upon which it ends the loop. We also need to keep track of how many rungs we have created to number our rungs correctly.</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">VBA</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>'loop through input tags to create rungs
    
Dim i As Integer
i = 2 'Set at the row value of the first tag

Dim inputRungNumber, outputRungNumber As Integer
inputRungNumber = 1
outputRungNumber = 1

'check the contents of the first cell
Dim tagName As Range
Set tagName = Worksheets("Sheet1").Cells(i, 1)
Do While Not IsEmpty(tagName.Value)</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: #6A9955">&apos;loop through input tags to create rungs</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> i </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Integer</span></span>
<span class="line"><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4"> </span><span style="color: #6A9955">&apos;Set at the row value of the first tag</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> inputRungNumber, outputRungNumber</span><span style="color: #D4D4D4"> As </span><span style="color: #4EC9B0">Integer</span></span>
<span class="line"><span style="color: #9CDCFE">inputRungNumber</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #9CDCFE">outputRungNumber</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">1</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">&apos;check the contents of the first cell</span></span>
<span class="line"><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> tagName </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">Range</span></span>
<span class="line"><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">tagName</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #C586C0">Do</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">While</span><span style="color: #D4D4D4"> Not </span><span style="color: #DCDCAA">IsEmpty</span><span style="color: #D4D4D4">(tagName.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4">)</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-creating-rungs">Creating Rungs</h2>



<p class="wp-block-paragraph">Finally, we can create our rungs. By looking at the tag type column, we determine whether it is an input or output and whether it is analog or digital. For a digital value, we use an open contact and coil. These are the <strong>XIC</strong> and <strong>OTE </strong>instructions. For an analog value, we use the move function, <strong>MOV</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">VBA</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>'Read Tag Type
        Dim tagType As String
        tagType = Worksheets("Sheet1").Cells(i, 2).Value

        'Read Module info
        Dim module, slot, channel, point As Range
        Set module = Worksheets("Sheet1").Cells(i, 3)
        Set slot = Worksheets("Sheet1").Cells(i, 4)
        Set channel = Worksheets("Sheet1").Cells(i, 5)
        Set point = Worksheets("Sheet1").Cells(i, 6)
        
        'Create Digital Input Rung
        If tagType = "DI" Then
            inputRungNumber = inputRungNumber + 1
            myInputFile.writeLine "&lt;Rung Number=""" &amp; inputRungNumber &amp; """ Type=""N"">"
            myInputFile.writeLine "&lt;Text>"
            myInputFile.writeLine "&lt;![CDATA&#91;XIC(" &amp; module.Value &amp; ":" &amp; slot.Value &amp; ":" &amp; channel.Value &amp; "." &amp; point.Value &amp; ")OTE(" &amp; tagName.Value &amp; ");&#93;]>"
            myInputFile.writeLine "&lt;/Text>"
            myInputFile.writeLine "&lt;/Rung>"
        
        'Create Digital Output Rung
        ElseIf tagType = "DO" Then
            outputRungNumber = outputRungNumber + 1
            myOutputFile.writeLine "&lt;Rung Number=""" &amp; outputRungNumber &amp; """ Type=""N"">"
            myOutputFile.writeLine "&lt;Text>"
            myOutputFile.writeLine "&lt;![CDATA&#91;XIC(" &amp; tagName.Value &amp; ")OTE(" &amp; module.Value &amp; ":" &amp; slot.Value &amp; ":" &amp; channel.Value &amp; "." &amp; point.Value &amp; ");&#93;]>"
            myOutputFile.writeLine "&lt;/Text>"
            myOutputFile.writeLine "&lt;/Rung>"
            
        'Create Analog Input Rung
        ElseIf tagType = "AI" Then
            inputRungNumber = inputRungNumber + 1
            myInputFile.writeLine "&lt;Rung Number=""" &amp; inputRungNumber &amp; """ Type=""N"">"
            myInputFile.writeLine "&lt;Text>"
            myInputFile.writeLine "&lt;![CDATA&#91;MOV(" &amp; module.Value &amp; ":" &amp; slot.Value &amp; ":" &amp; channel.Value &amp; "." &amp; point.Value &amp; "," &amp; tagName.Value &amp; ");&#93;]>"
            myInputFile.writeLine "&lt;/Text>"
            myInputFile.writeLine "&lt;/Rung>"
        
        'Create Analog Output Rung
        ElseIf tagType = "AO" Then
            outputRungNumber = outputRungNumber + 1
            myOutputFile.writeLine "&lt;Rung Number=""" &amp; outputRungNumber &amp; """ Type=""N"">"
            myOutputFile.writeLine "&lt;Text>"
            myOutputFile.writeLine "&lt;![CDATA&#91;MOV(" &amp; tagName.Value &amp; "," &amp; module.Value &amp; ":" &amp; slot.Value &amp; ":" &amp; channel.Value &amp; "." &amp; point.Value &amp; ");&#93;]>"
            myOutputFile.writeLine "&lt;/Text>"
            myOutputFile.writeLine "&lt;/Rung>"
        End If
      
        i = i + 1
        Set tagName = Worksheets("Sheet1").Cells(i + 1, 1)</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: #6A9955">&apos;Read Tag Type</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> tagType </span><span style="color: #D4D4D4">As </span><span style="color: #4EC9B0">String</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #9CDCFE">tagType</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4">).Value</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #6A9955">&apos;Read Module info</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Dim</span><span style="color: #9CDCFE"> module, slot</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> channel</span><span style="color: #D4D4D4">,</span><span style="color: #9CDCFE"> point</span><span style="color: #D4D4D4"> As </span><span style="color: #4EC9B0">Range</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">module</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">slot</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">4</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">channel</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">5</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">point</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">6</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">        </span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #6A9955">&apos;Create Digital Input Rung</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">If</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tagType</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;DI&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">inputRungNumber</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> inputRungNumber</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Rung Number=&quot;&quot;&quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> inputRungNumber</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;&quot;&quot; Type=&quot;&quot;N&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;![CDATA&#91;XIC(&quot;</span><span style="color: #D4D4D4"> &amp; module.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; slot.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; channel.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;.&quot;</span><span style="color: #D4D4D4"> &amp; point.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;)OTE(&quot;</span><span style="color: #D4D4D4"> &amp; tagName.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;);&#93;]&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Rung&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #6A9955">&apos;Create Digital Output Rung</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">ElseIf</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tagType</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;DO&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">outputRungNumber</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> outputRungNumber</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Rung Number=&quot;&quot;&quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> outputRungNumber</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;&quot;&quot; Type=&quot;&quot;N&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;![CDATA&#91;XIC(&quot;</span><span style="color: #D4D4D4"> &amp; tagName.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;)OTE(&quot;</span><span style="color: #D4D4D4"> &amp; module.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; slot.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; channel.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;.&quot;</span><span style="color: #D4D4D4"> &amp; point.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;);&#93;]&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Rung&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            </span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #6A9955">&apos;Create Analog Input Rung</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">ElseIf</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tagType</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;AI&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">inputRungNumber</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> inputRungNumber</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Rung Number=&quot;&quot;&quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> inputRungNumber</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;&quot;&quot; Type=&quot;&quot;N&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;![CDATA&#91;MOV(&quot;</span><span style="color: #D4D4D4"> &amp; module.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; slot.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; channel.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;.&quot;</span><span style="color: #D4D4D4"> &amp; point.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;,&quot;</span><span style="color: #D4D4D4"> &amp; tagName.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;);&#93;]&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Rung&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #6A9955">&apos;Create Analog Output Rung</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">ElseIf</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tagType</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;AO&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #C586C0">Then</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">outputRungNumber</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> outputRungNumber</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Rung Number=&quot;&quot;&quot;</span><span style="color: #D4D4D4"> &amp;</span><span style="color: #9CDCFE"> outputRungNumber</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;&quot;&quot; Type=&quot;&quot;N&quot;&quot;&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;![CDATA&#91;MOV(&quot;</span><span style="color: #D4D4D4"> &amp; tagName.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;,&quot;</span><span style="color: #D4D4D4"> &amp; module.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; slot.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;:&quot;</span><span style="color: #D4D4D4"> &amp; channel.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;.&quot;</span><span style="color: #D4D4D4"> &amp; point.</span><span style="color: #9CDCFE">Value</span><span style="color: #D4D4D4"> &amp; </span><span style="color: #CE9178">&quot;);&#93;]&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Text&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">            myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Rung&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">End If</span></span>
<span class="line"><span style="color: #D4D4D4">      </span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> =</span><span style="color: #9CDCFE"> i</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">tagName</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">Worksheets</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;Sheet1&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">Cells</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> + </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">, </span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">)</span></span></code></pre></div>



<h2 class="wp-block-heading" id="h-closing-the-files">Closing the Files</h2>



<p class="wp-block-paragraph">Once we have looped through all our values, we can end the loop and create the footer information. The final step is to close the files and release the files by setting our variables to nothing.</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">VBA</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>Loop

    '=============INPUT==============
    'Close the routine and program
    myInputFile.writeLine "&lt;/RLLContent>"
    myInputFile.writeLine "&lt;/Routine>"
    myInputFile.writeLine "&lt;/Routines>"
    myInputFile.writeLine "&lt;/Program>"
    myInputFile.writeLine "&lt;/Programs>"
    
    'Create footer information
    myInputFile.writeLine "&lt;/Controller>"
    myInputFile.writeLine "&lt;/RSLogix5000Content>"
    
    '=============OUTPUT==============
    'Close the routine and program
    myOutputFile.writeLine "&lt;/RLLContent>"
    myOutputFile.writeLine "&lt;/Routine>"
    myOutputFile.writeLine "&lt;/Routines>"
    myOutputFile.writeLine "&lt;/Program>"
    myOutputFile.writeLine "&lt;/Programs>"
    
    'Create footer information
    myOutputFile.writeLine "&lt;/Controller>"
    myOutputFile.writeLine "&lt;/RSLogix5000Content>"
    
    'Close File and set to nothing
    myInputFile.Close
    Set myInputFile = Nothing
    myOutputFile.Close
    Set myOutputFile = Nothing
	End Sub</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: #C586C0">Loop</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;=============INPUT==============</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;Close the routine and program</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/RLLContent&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Routine&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Routines&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Program&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Programs&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;Create footer information</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Controller&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/RSLogix5000Content&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;=============OUTPUT==============</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;Close the routine and program</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/RLLContent&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Routine&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Routines&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Program&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Programs&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;Create footer information</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/Controller&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.writeLine </span><span style="color: #CE9178">&quot;&lt;/RSLogix5000Content&gt;&quot;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">&apos;Close File and set to nothing</span></span>
<span class="line"><span style="color: #D4D4D4">    myInputFile.Close</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">myInputFile</span><span style="color: #D4D4D4"> =</span><span style="color: #569CD6"> Nothing</span></span>
<span class="line"><span style="color: #D4D4D4">    myOutputFile.Close</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">Set </span><span style="color: #9CDCFE">myOutputFile</span><span style="color: #D4D4D4"> =</span><span style="color: #569CD6"> Nothing</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">End Sub</span></span></code></pre></div>



<p class="wp-block-paragraph">This method of creating buffering routines requires some overhead to set up, but once the macro is created, it will generate the routines for any number of tabs. If massive changes need to be made, this workbook can be edited and then the routine can be reimported. This type of macro has advantages beyond buffering and can be used to generate any amount of code with repetition.</p>



<p class="wp-block-paragraph">Leveraging tools like these is one of the ways that DMC makes our programming more efficient and robust. Using Excel Macros in Rockwell programming can save time from writing tedious code and will allow the programmer to focus on more important issues.</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Allen Bradley PLC Programming</a> expertise.</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/manufacturing-automation-and-intelligence">Manufacturing Automation &amp; Intelligence Services</a>&nbsp;and <a href="/contact">contact us</a> for any project inquiries.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21783/generating-buffering-routines-on-an-allen-bradley-plc-using-excel-macros/">Generating Buffering Routines on an Allen Bradley PLC Using Excel Macros</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Rockwell FactoryTalk Studio Basics: Global Objects and Tag Substitution</title>
		<link>https://static.dmcinfo.com/blog/25413/rockwell-factorytalk-studio-basics-global-objects-and-tag-substitution/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 26 Jul 2016 14:13:46 +0000</pubDate>
				<category><![CDATA[Allen Bradley PLC]]></category>
		<category><![CDATA[HMI and SCADA]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[FactoryTalk]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[Rockwell]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/25413/rockwell-factorytalk-studio-basics-global-objects-and-tag-substitution/</guid>

					<description><![CDATA[<p>Global Objects in Rockwell Automation / Allen-Bradley&#8217;s FactoryTalk HMI development environment are useful to bring modularization and efficient repeatability of common elements in your project. This basic feature has been around for a long time, but knowing how to use Global Objects effectively can greatly reduce your development time, chance of errors, and number of [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25413/rockwell-factorytalk-studio-basics-global-objects-and-tag-substitution/">Rockwell FactoryTalk Studio Basics: Global Objects and Tag Substitution</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Global Objects in Rockwell Automation / Allen-Bradley&#8217;s <a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming/rockwell-factorytalk">FactoryTalk HMI development environment</a> are useful to bring modularization and efficient repeatability of common elements in your project. This basic feature has been around for a long time, but knowing how to use Global Objects effectively can greatly reduce your development time, chance of errors, and number of displays to license at runtime.&nbsp;</p>



<p class="wp-block-paragraph">In this tutorial, I will show you how to set up a simple control valve as a Global Object which links to a pop-up faceplate using Tag Substitution. The final result will allow us to input just three parameters to generate a new valve on the HMI. I will be showing the development for FactoryTalk View Site Edition (SE), but also applies to Machine Edition (ME).</p>



<p class="wp-block-paragraph">Global Objects use a special type of display which allows you to link back to the parent when used in a &#8216;normal&#8217; display screen. They are more powerful than a simple template for a group of objects; any formatting or animation changes made to the Global Object propagate to all its instances in the project. Another advantage of Global Objects is that they are particularly suited for coordination in the PLC through User-Defined Data Types (UDTs) and Add-On Instructions (AOIs), which allow for consistent tag structure and modular logic.<br>
&nbsp;</p>



<h2 class="wp-block-heading" id="h-basic-setup">Basic Setup</h2>



<p class="wp-block-paragraph">First off, I have developed a simple PLC program which utilizes the UDT &#8216;udtValve&#8217; to track what is going on with our valve called &#8216;HMI_CYL&#8217;. The members of the UDT will be used on the HMI to display status animations for the valve. There is also an AOI on the PLC side which handles the logic and makes it easy for me to instantiate new valves into my PLC project.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-utdvalve" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/PLC_udt_1.png"><br>
<em>User defined data type &#8216;udtValve&#8217;.</em>&nbsp;</p>



<p class="wp-block-paragraph">Now that the PLC side is set, let&#8217;s move over to the HMI project. Go to &#8216;Graphics&#8217; -&gt; &#8216;Global Objects&#8217; -&gt; [Right Click] &#8216;New&#8217; to create a new global object display in FactoryTalk Studio. I&#8217;ve drawn an object group for the valve and set up color animation for the valve to show green when open, gray when closed, and red when faulted. In my PLC code, the &#8216;.Status&#8217; member of udtValve outputs a number for each of these states.<br>
&nbsp;<br>
This is where global objects are extremely helpful &#8212; we do not want to copy/paste into each animation if we need to create many valves in a project! We can insert a <strong>placeholder parameter</strong> instead of a direct PLC tag in the animation so that we can make the global object generic. Use &#8216;#1&#8217; then &#8216;.(name of UDT&nbsp;<br>
member)&#8217; to access a specific tag member of the UDT. We could create other tag placeholders that are different UDTs or just normal tags by referencing &#8216;#2&#8217;, &#8216;#3&#8217;, etc., up to &#8216;#500&#8217;. &nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk--global-object-animation" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Animation_with_GlobalObject.png"><br>
<em>Global Object Animation</em></p>



<p class="wp-block-paragraph">Next, we need to set up a definition for the parameter we just referenced. Right-click on the object (make sure all of the drawing objects are grouped together) and navigate to &#8216;Global Object Parameter Definitions&#8217;. For each placeholder you reference, you must list here with the # and number.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-global-object-parameter-definition" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/GlobalObject_BasicParameters.png"><br>
<em>Global object parameter definition</em></p>



<p class="wp-block-paragraph">Now we are ready to create an instance of the global object into our desired runtime screen. Simply copy/paste the global object group, then right click -&gt; &#8216;Global Object Parameter Values&#8217;. This is where we link the PLC instance name of the particular valve we want to reference to those placeholders we put in the animation. The result will concatenate to get the whole tag &#8216;[PLC]HMI_CYL.Status&#8217; in runtime.</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-global-object-parameter-values" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/GlobalObject_LinkingParameters.png"><br>
<em>Global object parameter values</em></p>



<h2 class="wp-block-heading" id="h-beyond-the-basics">Beyond the Basics</h2>



<p class="wp-block-paragraph">Alright, we&#8217;ve created a simple global object! We have a valve that changes color based on the feedback from the PLC logic. There&#8217;s a few other things we can do to give the users of our HMI application more information and control of the valve. I&#8217;m going to add a pop-up that displays when we click on the valve and a placeholder to show the name of each valve instance. &nbsp;<br>
&nbsp;<br>
Let&#8217;s start with the valve name placeholder. Add a text box to the valve global object. In its text properties, click &#8216;Insert Variable&#8217; -&gt; &#8216;String..&#8217; &nbsp;then choose &#8216;Literal string&#8217; and input &#8216;#2&#8217; to create a new placeholder. The code generated should look something like this (depending on the options you choose in the dialogue box):&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-tag-substitution" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/String_placeholder.png"><br>
<em>Tag substitution using literal string &nbsp;</em></p>



<p class="wp-block-paragraph">Edit the global object parameter definitions again to account for the &#8216;#2&#8217; placeholder we just added. Drag a new instance of the global object to your display screen and open its parameter values. Because we chose &#8216;Literal string&#8217;, we can now input normal text to display with our global object, instead of linking to a PLC tag. If you do want it to link to a string tag in the PLC, then choose &#8216;Tag&#8217; when you Insert Variable into the text box setup. &nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/LinkingStringPlaceholder.png"><br>
<em>Global object parameter values using string for tag name</em></p>



<p class="wp-block-paragraph">Finally, we are going to create a pop-up which displays when you click on the valve. For this we will use a normal display instead of a global object display, but will reference it from our global object. Our pop-up will also use tag substitution &#8212; it doesn&#8217;t just apply to global objects!<br>
&nbsp;<br>
I&#8217;ve created a display called &#8216;CV_Faceplate&#8217; which shows additional valve statuses and has buttons which can be used to open and close the valve if it is in manual mode. Each of the tags use a &#8216;#1&#8217; placeholder with ‘.(Name of UDT member)’ just like the global object. I&#8217;ve also added the &#8216;#2&#8217; placeholder for the valve name and additionally I&#8217;ve added a &#8216;#3&#8217; literal string placeholder for a valve description. &nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-control-valve-faceplate" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/TagSubstitutionFaceplate.png"><em>Control valve faceplate / pop-up using tag substitution&nbsp;&nbsp;</em></p>



<p class="wp-block-paragraph">Now we are going to go back to the global object. I want the pop-up I created to display when the valve is clicked on, so I will add a Touch animation, which uses the display command, and /T to invoke tag substitution. Add &#8216;#3&#8217; to the global object parameter definitions. Take note that #3 is not used in the global object itself, it is passed to the pop-up display only!</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-display-faceplate" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/TouchAnimation_FaceplateDisplay.png"><em>Display faceplate/pop-up from global object</em></p>



<p class="wp-block-paragraph">Important Note: Because we are using the global object to tag substitute to the pop-up display, we are also putting #1, #2, and #3 in the display command which are linked to our global object parameter values. We could also put direct tag references in the display command which correspond to each of tag placeholders in the pop-up display if we wanted to call the pop-up outside of a global object. In that case, our Touch animation would look like: &#8216;Display CV_Faceplate /T {[PLC]Another_Valve} {CV-150} {‘CV-150 Description’} /cc&#8217;.&nbsp;<br>
&nbsp;<br>
We&#8217;ve created a valve which displays a status pop-up without having to change any background code to create a new instance. To create new valves, all we need to do is copy the global object and fill in its three input parameters! Here are a few views in runtime:</p>



<p class="wp-block-paragraph"><img decoding="async" alt="factory-talk-animated-control-valve" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Example1_1.png"><br>
<em>Animated control valve global object and faceplate / pop-up example 1</em></p>



<p class="wp-block-paragraph"><img decoding="async" alt="favtory-talk-animated-control-valve" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Example2.png"><br>
<em>Animated control valve global object and faceplate / pop-up example 2</em></p>



<p class="wp-block-paragraph"><img decoding="async" alt="animated-control-valve-rockwell" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Example3.png"><br>
<em>Animated control valve global object and faceplate / pop-up example 3</em></p>



<h2 class="wp-block-heading" id="h-tips">Tips</h2>



<ul class="wp-block-list">
<li>To test your global object, make sure you generate an actual client for runtime. Switching your screen to &#8216;Test Display&#8217; may make it look like your global object is not working correctly.</li>



<li>You can create multiple global objects in one global object display screen. Each group of objects can have separate parameter definitions and be dragged into displays individually.</li>



<li>If you want to modify an instance of a global object separately from the parent, you can &#8216;Break Link&#8217; by right-clicking on the instance in the display. It is also useful if you do want to use a global object as a graphic template, or you don&#8217;t want changes to the global object to propagate to the children.&nbsp;</li>
</ul>



<p class="wp-block-paragraph">Tools which create modular, reusable code like Global Objects, Tag Substitution, User-Defined Data Types (UDT), and Add-On-Instructions (AOI) greatly reduce your development time and makes your implementation much easier to get up and running. DMC focuses on these strategies for both PLC and HMI/SCADA in order to deliver efficient, high-performance applications to our customers across many development platforms. See this blog, <a href="https://static.dmcinfo.com/latest-thinking/blog/id/9136/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>, for similar tips in the Siemens platform. </p>



<p class="wp-block-paragraph"><a href="/contact">Contact</a> DMC for assistance on your next PLC project.</p>



<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/services/manufacturing-automation-and-intelligence/hmi-and-scada-programming"><strong>Learn more about DMC&#8217;s HMI and SCADA programming solutions.</strong></a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/25413/rockwell-factorytalk-studio-basics-global-objects-and-tag-substitution/">Rockwell FactoryTalk Studio Basics: Global Objects and Tag Substitution</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Source Code Protection in Studio 5000 Logix Designer</title>
		<link>https://static.dmcinfo.com/blog/27787/source-code-protection-in-studio-5000-logix-designer/</link>
		
		<dc:creator><![CDATA[Jason Mayes]]></dc:creator>
		<pubDate>Wed, 05 Feb 2014 23:00:14 +0000</pubDate>
				<category><![CDATA[Allen Bradley PLC]]></category>
		<category><![CDATA[Manufacturing Automation & Intelligence]]></category>
		<category><![CDATA[PLC]]></category>
		<category><![CDATA[PLC Programming]]></category>
		<category><![CDATA[Rockwell]]></category>
		<category><![CDATA[RSLogix]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/27787/source-code-protection-in-studio-5000-logix-designer/</guid>

					<description><![CDATA[<p>While working with a customer on a recent RSLogix 5000 project (now called Studio 5000), there was a need to protect some proprietary source code. In this particular case, DMC had developed a custom Add-On Instruction (AOI) to be used within the project that contained some unique logic that the client wished to protect. This [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/27787/source-code-protection-in-studio-5000-logix-designer/">Source Code Protection in Studio 5000 Logix Designer</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">While working with a customer on a recent RSLogix 5000 project (now called Studio 5000), there was a need to protect some proprietary source code. In this particular case, DMC had developed a custom Add-On Instruction (AOI) to be used within the project that contained some unique logic that the client wished to protect. This is incredibly easy to do. Rockwell provides an easy tool for this that comes prepackaged with RSLogix.&nbsp;</p>



<p class="wp-block-paragraph">Since protecting intellectual property or touchy algorithms while opening up some of the code for modification or troubleshooting is pretty common, I thought I&#8217;d share some of the info I found and provide a few easy steps to locking down your code. Incidentally, while I&#8217;ll walk you through configuring an AOI for source protection, you can use the same approach to protect routines as well.</p>



<p class="wp-block-paragraph">Note that all of the information below can be found in various forms in two useful documents published by Rockwell Automation that I would highly recommend you download for reference:</p>



<ul class="wp-block-list">
<li><a href="http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm010_-en-p.pdf" target="_blank" rel="noreferrer noopener">Logix5000 Controllers Add-On Instructions</a></li>



<li><a href="http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm016_-en-p.pdf" target="_blank" rel="noreferrer noopener">Logix5000 Controllers Security</a></li>
</ul>



<h2 id="h-enabling-source-protection" class="wp-block-heading">Enabling Source Protection</h2>



<p class="wp-block-paragraph">Out of the box, source code protection is not enabled in RSLogix 5000. So if you have never used it, chances are good that its never been activated. To check, open up the project you are working on and look under Tools &gt;&gt; Security. If you don&#8217;t see an option for &#8220;Configure Source Protection,&#8221; then you will need to enable it.</p>



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



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



<p class="wp-block-paragraph">I would assume that you really only need to make a quick registry change, but its even easier than that as Rockwell provides a free tool you can download and run to take care of it for you. Allen Bradley provides some good instructions for the process that outline the different methods for different revs of RSLogix in <a href="http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm016_-en-p.pdf" target="_blank" rel="noreferrer noopener">Logix5000 Controllers Security</a>. In my case, using rev 20, I needed to download Allen Bradley&#8217;s Source Protection Tool. To find it, I started at their <a href="https://www.rockwellautomation.com/en-us/support/product/product-downloads.html" target="_blank" rel="noreferrer noopener">software download page</a> and searched RSLogix Downloads. You should see it listed as &#8220;RSLogix 5000 Source Protection Tool.&#8221; This is a quick download. After running, restart RSLogix and you should see a new option under Tools >> Security: Configure Source Protection.</p>



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



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



<p class="wp-block-paragraph">Ok, after enabling, you can choose your newly available option and you will now be prompted to specify a Source Key File location. Go ahead and choose a location. If you don&#8217;t have a source key file in the specified directory, you will be asked if you would like to create one. This source key file will contain your keys for any protection you establish. This file can be moved from computer to computer, or it can be built locally by adding the keys you create. Go ahead and create a new one; once you&#8217;ve done so, you&#8217;re ready to lock down your code.</p>



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



<h2 id="h-protecting-an-aoi" class="wp-block-heading">Protecting an AOI</h2>



<p class="wp-block-paragraph">For a quick demo, I created a new project with a single Routine called &#8216;MyRoutine&#8217; and a single AOI, &#8216;MyAddOnInstruction.&#8217; Once you open up Source Protection Configuration from Tools &gt;&gt; Security, you will see that your programs and Add-On Instructions will be available. You can configure different keys and settings for each program and AOI, but lets just walk through configuration of &#8216;MyAddOnInstruction.&#8217; Take a look and notice that there are currently no Source Keys defined.</p>



<p class="wp-block-paragraph"><p style="text-align: center;">&nbsp;<img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/SourceProtection1.jpg"></p></p>



<p class="wp-block-paragraph"><p style="text-align: center;">&nbsp;</p></p>



<p class="wp-block-paragraph">Select your AOI you would like to protect and choose &#8220;Protect.&#8221; A Source Key dialog will open allowing you to select or create a source key to apply to your selected component (in this case, our AOI). I&#8217;m going to create a new one, &#8220;MyKey&#8221; and name it DMC. If you choose not to show the key (characters will not be shown on the screen) you will need to confirm the key a second time. I prefer to just see what I&#8217;m typing. You can also define a Source Key Name. This is really just a friendly name to associate with your key (think of user name::password, key name::key) that will be shown in the Source Protection Dialog to protect your key from prying eyes.</p>



<p class="wp-block-paragraph"><p style="text-align: center;">&nbsp;<img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/SourceProtectionKey1.jpg"></p></p>



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



<p class="wp-block-paragraph">The checkbox in this dialog is worth discussing in a little more detail. You have two choices for the level of protection you are enabling. Leaving this check box unchecked will completely lock and hide the code source code from anyone without the key. Anyone viewing the project (or any project containing this AOI) without the key will not be able to view, access, or edit&nbsp;the source code for the instruction. Selecting the checkbox will allow a user to view, but not to modify the source code, in effect making it read-only. Of course with either selection, if you have the key, you have full access.</p>



<p class="wp-block-paragraph">It should be noted that in addition to protecting any sensitive code, this can also be used as a method of source or version control and can be a great way to prevent unauthorized or unintended edits to sections of source code that have been validated or released.</p>



<p class="wp-block-paragraph">Getting back to our walkthrough, let&#8217;s go ahead and leave the checkbox unchecked and select OK. This will bring us back to the Source Protection Configuration dialog again, but you will now see that the key &#8220;DMC&#8221; has been added to our AOI and it is not selected as viewable for anyone without the key.</p>



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



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



<p class="wp-block-paragraph">We&#8217;re done here. Choose &#8220;Close&#8221; to exit the dialog and take a look at your project tree. You shouldn&#8217;t notice any changes. You can still expand and see both Tags and Logic for the AOI we just protected. However, to see what it looks like to someone without the key, I&#8217;m going to save the project, exit RSLogix, and delete my key file. Now, after reopening the project we can see that I am not able to expand the AOI &#8211; there is no access to the Tags or Logic for the instruction.</p>



<p class="wp-block-paragraph"><p style="text-align: center;">&nbsp;<img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/KeyedProject.jpg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/UnKeyedProject.jpg"></p></p>



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



<p class="wp-block-paragraph">If we dig a little deeper and open up the Source Protection Configuration dialog again, we will see that &#8216;MyAddOnInstruction&#8217; is protected and has an unknown source key. Selecting the AOI and choosing &#8220;Protect&#8221; will bring us back to the Apply Source Key dialog. Attempting to apply a new source key other than the one we already created for this instruction will give an error and will not allow us to unlock it. However, I luckily grabbed a screenshot of the earlier showing me that I used the key &#8216;MyKey.&#8217; Sure enough, entering this key will unlock the AOI and allow access to the source code again.</p>



<p class="wp-block-paragraph">It is also worth taking the time here to export our AOI. Normally, an exported AOI will be saved in human readable text in an XML type format (try it!). However, when source protection has been enabled, this exported file is encrypted.</p>



<p class="wp-block-paragraph">Before I wrap this up, I want to get back to one more point. I touched upon this earlier, but it&#8217;s worth mentioning that there are many reasons one may want to use Source Protection within their project. In addition to protecting proprietary code, it can also be a useful method of source control. A good example may be a custom motor implementation in a large project. Once development and testing have been completed on the instruction or routine, the code could be locked by the creator to prevent any accidental changes by others. By locking and then exporting to a library, other developers can then use the instruction and be guaranteed that the source code has not been modified.</p>



<p class="wp-block-paragraph">This, combined with the version information available for each AOI and routine, can be a great way to manage a shared library of reusable code. DMC strives to make code as reusable as possible as a means to decrease development time (and cost), increase reliability, and provide for scalability and modularity. Combining this with versioning software such as SVN provides for an easy way to maintain a library for all our engineers to share.</p>



<p class="wp-block-paragraph">Finally, a quick disclaimer about security. I personally haven’t delved into how encrypted or hidden this method of source code protection is, but it will probably serve for the majority of purposes. In the case of extremely valuable intellectual property, I would always strongly recommend consulting with experts before trusting that this is bulletproof. DMC has acquired a wealth of experience in the past years protecting valuable information and has the experts available should this be the case.</p>



<p class="wp-block-paragraph"><a href="/contact">Contact DMC</a> with any questions or to get started on your next project.</p>



<p class="wp-block-paragraph"><strong><a href="/services/manufacturing-automation-and-intelligence/plc-programming/allen-bradley-plc-programming">Learn more about DMC&#8217;s Allen Bradley PLC programming services.</a></strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/27787/source-code-protection-in-studio-5000-logix-designer/">Source Code Protection in Studio 5000 Logix Designer</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>
