1648
|
1 |
<?xml version='1.0' encoding='utf-8'?>
|
|
2 |
<PyFile xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
3 |
<variables/>
|
|
4 |
<globals>
|
|
5 |
<xhtml:p><![CDATA[import threading, time
|
|
6 |
|
|
7 |
MyT = None
|
|
8 |
Stop = False
|
|
9 |
|
|
10 |
def StartLog():
|
|
11 |
global MyT
|
|
12 |
MyT=threading.Thread(target = DoLog)
|
|
13 |
MyT.start()
|
|
14 |
|
|
15 |
def DoLog():
|
|
16 |
global Stop
|
|
17 |
while not Stop:
|
|
18 |
PLCObject.LogMessage("Python side Logging (PLC is %s)"%PLCObject.PLCStatus)
|
|
19 |
time.sleep(0.3)
|
|
20 |
|
|
21 |
def StopLog():
|
|
22 |
global MyT,Stop
|
|
23 |
Stop=True
|
|
24 |
|
|
25 |
_runtime_init.append(StartLog)
|
|
26 |
_runtime_cleanup.append(StopLog)
|
|
27 |
]]></xhtml:p>
|
|
28 |
</globals>
|
|
29 |
<init>
|
|
30 |
<xhtml:p><![CDATA[]]></xhtml:p>
|
|
31 |
</init>
|
|
32 |
<cleanup>
|
|
33 |
<xhtml:p><![CDATA[]]></xhtml:p>
|
|
34 |
</cleanup>
|
|
35 |
<start>
|
|
36 |
<xhtml:p><![CDATA[]]></xhtml:p>
|
|
37 |
</start>
|
|
38 |
<stop>
|
|
39 |
<xhtml:p><![CDATA[]]></xhtml:p>
|
|
40 |
</stop>
|
|
41 |
</PyFile>
|