lpcmanager

Added RTC block.

2016-10-27, dporopat
64c26e46c131
Parents bd67abf4220c
Children 72fa9df3b675
Added RTC block.
--- a/LPCManager.py Fri Oct 21 08:37:14 2016 +0200
+++ b/LPCManager.py Thu Oct 27 14:56:23 2016 +0200
@@ -83,13 +83,16 @@
def GetLibraryPath(self):
return os.path.join(_lpcmanager_path + '/Pous/', "pousGOT.xml")
+class PLCLibraryRTC(POULibrary):
+ def GetLibraryPath(self):
+ return os.path.join(_lpcmanager_path + '/Pous/', "pousRTC.xml")
features.libraries=[('Native', 'NativeLib.NativeLibrary')]
if arch == "MC9":
- features.libraries += [('Python', 'py_ext.PythonLibrary')]
+ features.libraries += [('RTC', lambda: PLCLibraryRTC),('Python', 'py_ext.PythonLibrary')]
elif arch == "GOT":
- features.libraries += [('GOT', lambda: PLCLibraryGOT),('Python', 'py_ext.PythonLibrary')]
+ features.libraries += [('RTC', lambda: PLCLibraryRTC),('GOT', lambda: PLCLibraryGOT),('Python', 'py_ext.PythonLibrary')]
else:
features.libraries += [('LPC', lambda: PLCLibraryLPC)]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Pous/pousRTC.xml Thu Oct 27 14:56:23 2016 +0200
@@ -0,0 +1,150 @@
+<?xml version='1.0' encoding='utf-8'?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
+ <fileHeader companyName="Beremiz" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:53:26"/>
+ <contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2014-03-17T08:07:24">
+ <coordinateInfo>
+ <fbd>
+ <scaling x="0" y="0"/>
+ </fbd>
+ <ld>
+ <scaling x="0" y="0"/>
+ </ld>
+ <sfc>
+ <scaling x="0" y="0"/>
+ </sfc>
+ </coordinateInfo>
+ </contentHeader>
+ <types>
+ <dataTypes/>
+ <pous>
+ <pou name="python_RTC" pouType="functionBlock">
+ <interface>
+ <inputVars>
+ <variable name="TRIG">
+ <type>
+ <BOOL/>
+ </type>
+ </variable>
+ <variable name="DT_IN">
+ <type>
+ <INT/>
+ </type>
+ </variable>
+ </inputVars>
+ <outputVars>
+ <variable name="DT_OUT">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="YEAR">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ <variable name="MONTH">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ <variable name="DAY">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ <variable name="HOUR">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ <variable name="MINUTES">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ <variable name="SECONDS">
+ <type>
+ <UINT/>
+ </type>
+ </variable>
+ </outputVars>
+ <localVars>
+ <variable name="pooll0">
+ <type>
+ <derived name="python_poll"/>
+ </type>
+ </variable>
+ <variable name="ACK">
+ <type>
+ <BOOL/>
+ </type>
+ </variable>
+ <variable name="INPUT_ARGS">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="INPUT_TYPE">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="INPUT_VALUE">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="INPUT_VALUE_CODE">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="CODE">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="YEAR_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="MONTH_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="DAY_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="HOUR_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="MINUTES_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ <variable name="SECONDS_STR">
+ <type>
+ <string/>
+ </type>
+ </variable>
+ </localVars>
+ </interface>
+ <body>
+ <ST>
+ <xhtml:p><![CDATA[INPUT_VALUE:=INT_TO_STRING(DT_IN); INPUT_ARGS:=CONCAT(INPUT_VALUE); INPUT_VALUE_CODE:=CONCAT('PLCObject.MWProvider.SetGetRTC(', INPUT_ARGS, ')'); pooll0(TRIG:=TRIG, CODE:=INPUT_VALUE_CODE, ACK => ACK, RESULT => DT_OUT); YEAR_STR:=MID(IN:=DT_OUT,L:=4,P:=1); YEAR:=STRING_TO_UINT(IN:=YEAR_STR); MONTH_STR:=MID(IN:=DT_OUT,L:=2,P:=6); MONTH:=STRING_TO_UINT(IN:=MONTH_STR); DAY_STR:=MID(IN:=DT_OUT,L:=2,P:=9); DAY:=STRING_TO_UINT(IN:=DAY_STR); HOUR_STR:=MID(IN:=DT_OUT,L:=2,P:=12); HOUR:=STRING_TO_UINT(IN:=HOUR_STR); MINUTES_STR:=MID(IN:=DT_OUT,L:=2,P:=15); MINUTES:=STRING_TO_UINT(IN:=MINUTES_STR); SECONDS_STR:=MID(IN:=DT_OUT,L:=2,P:=18); SECONDS:=STRING_TO_UINT(IN:=SECONDS_STR);]]></xhtml:p>
+ </ST>
+ </body>
+ </pou>
+ </pous>
+ </types>
+ <instances>
+ <configurations/>
+ </instances>
+</project>