Skip to content

Instantly share code, notes, and snippets.

@garretfick
Created March 1, 2019 21:17
Show Gist options
  • Save garretfick/c5017aba5b011600d61c22daec804e62 to your computer and use it in GitHub Desktop.
Save garretfick/c5017aba5b011600d61c22daec804e62 to your computer and use it in GitHub Desktop.
HelloWorld for OpenPLC and Modbus on SoftPLC
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6.xsd" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Garret Fick" productName="OpenPLC" productVersion="1.0" creationDateTime="2019-03-01T09:56:49"/>
<contentHeader name="HelloWorld" modificationDateTime="2019-03-01T14:00:37">
<coordinateInfo>
<fbd>
<scaling x="10" y="10"/>
</fbd>
<ld>
<scaling x="0" y="0"/>
</ld>
<sfc>
<scaling x="0" y="0"/>
</sfc>
</coordinateInfo>
</contentHeader>
<types>
<dataTypes/>
<pous>
<pou name="Hello_World" pouType="program">
<interface>
<localVars>
<variable name="PB1" address="%IX0.0">
<type>
<BOOL/>
</type>
</variable>
<variable name="PB2" address="%IX0.1">
<type>
<BOOL/>
</type>
</variable>
<variable name="LED" address="%QX0.0">
<type>
<BOOL/>
</type>
</variable>
</localVars>
</interface>
<body>
<LD>
<leftPowerRail localId="1" height="136" width="3">
<position x="87" y="49"/>
<connectionPointOut formalParameter="">
<relPosition x="3" y="20"/>
</connectionPointOut>
<connectionPointOut formalParameter="">
<relPosition x="3" y="116"/>
</connectionPointOut>
</leftPowerRail>
<contact localId="2" height="15" width="21" negated="false">
<position x="207" y="61"/>
<connectionPointIn>
<relPosition x="0" y="8"/>
<connection refLocalId="1">
<position x="207" y="69"/>
<position x="90" y="69"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="8"/>
</connectionPointOut>
<variable>PB1</variable>
</contact>
<contact localId="3" height="15" width="21" negated="false" executionOrderId="0">
<position x="201" y="157"/>
<connectionPointIn>
<relPosition x="0" y="8"/>
<connection refLocalId="1">
<position x="201" y="165"/>
<position x="90" y="165"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="8"/>
</connectionPointOut>
<variable>LED</variable>
</contact>
<contact localId="4" height="15" width="21" negated="true" executionOrderId="0">
<position x="365" y="61"/>
<connectionPointIn>
<relPosition x="0" y="8"/>
<connection refLocalId="2">
<position x="365" y="69"/>
<position x="228" y="69"/>
</connection>
<connection refLocalId="3">
<position x="365" y="69"/>
<position x="293" y="69"/>
<position x="293" y="165"/>
<position x="222" y="165"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="8"/>
</connectionPointOut>
<variable>PB2</variable>
</contact>
<coil localId="5" height="15" width="21" negated="false">
<position x="530" y="61"/>
<connectionPointIn>
<relPosition x="0" y="8"/>
<connection refLocalId="4">
<position x="530" y="69"/>
<position x="386" y="69"/>
</connection>
</connectionPointIn>
<connectionPointOut>
<relPosition x="21" y="8"/>
</connectionPointOut>
<variable>LED</variable>
</coil>
<rightPowerRail localId="6" height="40" width="3">
<position x="770" y="49"/>
<connectionPointIn>
<relPosition x="0" y="20"/>
<connection refLocalId="5">
<position x="770" y="69"/>
<position x="551" y="69"/>
</connection>
</connectionPointIn>
</rightPowerRail>
</LD>
</body>
</pou>
</pous>
</types>
<instances>
<configurations>
<configuration name="Config0">
<resource name="Res0">
<task name="Hello_World_Task" priority="0" interval="T#50ms">
<pouInstance name="instance0" typeName="Hello_World"/>
</task>
</resource>
</configuration>
</configurations>
</instances>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment