Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
P0009¶
- Code
P0009
- Message
TwinCAT XML file has invalid structure
This error occurs when a TwinCAT XML file (.TcPOU, .TcGVL, or .TcDUT) does not have the expected structure. TwinCAT files must have a TcPlcObject root element containing a POU, GVL, or DUT child element with a Declaration section.
Example¶
The following XML is missing the required Declaration element:
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="MAIN" Id="{00000000-0000-0000-0000-000000000000}">
<Implementation>
<ST><![CDATA[
myVar := myVar + 1;
]]></ST>
</Implementation>
</POU>
</TcPlcObject>
To fix this error, add a Declaration element containing the variable declarations:
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="MAIN" Id="{00000000-0000-0000-0000-000000000000}">
<Declaration><![CDATA[
PROGRAM MAIN
VAR
myVar : INT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[
myVar := myVar + 1;
]]></ST>
</Implementation>
</POU>
</TcPlcObject>