<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to TYPE define a new TYPE</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1ac149e003/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1ac149e003/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/1ac149e003/</id><updated>2020-02-27T14:02:21.380000Z</updated><subtitle>Recent posts to How to TYPE define a new TYPE</subtitle><entry><title>How to TYPE define a new TYPE</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1ac149e003/?limit=25#eff0" rel="alternate"/><published>2020-02-27T14:02:21.380000Z</published><updated>2020-02-27T14:02:21.380000Z</updated><author><name>Comingback4u</name><uri>https://forge.codesys.com/u/comingback4u/</uri></author><id>https://forge.codesys.com6a80c16de00ea978556aa6034fe97f944758c143</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Daniel are  you putting this all in the PLC_PRG POU? For the part:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* CIP Data type for string with a length of max. 64 chars *)&lt;/span&gt;
&lt;span class="n"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;STRING64&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;STRUCT&lt;/span&gt;
&lt;span class="n"&gt;uiLength&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;UINT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;sString&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;STRING&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;63&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="n"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You need to put this all in a DUT object. Right click your application-&amp;gt;add object-&amp;gt;DUT then select a tructure and name it STRING64. So it would look like:&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Set Attribute Example.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=3690"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to TYPE define a new TYPE</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/1ac149e003/?limit=25#12b8" rel="alternate"/><published>2020-02-27T14:02:21.112000Z</published><updated>2020-02-27T14:02:21.112000Z</updated><author><name>danielchang</name><uri>https://forge.codesys.com/u/danielchang/</uri></author><id>https://forge.codesys.com360a9ef84698f734e01afd3ea5f4c239d4f25761</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;I follow this help document &lt;a class="" href="https://help.codesys.com/webapp/rAlrUyiOs68zj7UlZdXT0yImTJI%2FSet_Attribute_Single;product=EtherNetIPServices;version=3.5.12.0" rel="nofollow"&gt;https://help.codesys.com/webapp/rAlrUyiOs68zj7UlZdXT0yImTJI%2FSet_Attribute_Single;product=EtherNetIPServices;version=3.5.12.0&lt;/a&gt; to test Ethernet/IP FB. But I can not build successful. Any one knows what wrong? Thanks.&lt;br/&gt;
(&lt;em&gt; CIP Data type for string with a length of max. 64 chars &lt;/em&gt;)&lt;br/&gt;
TYPE STRING64 :&lt;br/&gt;
STRUCT&lt;br/&gt;
   uiLength  : UINT;&lt;br/&gt;
   sString   : STRING(63);&lt;br/&gt;
END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;
&lt;p&gt;PROGRAM &lt;strong&gt;PLC_PRG&lt;/strong&gt;&lt;br/&gt;
VAR&lt;br/&gt;
    setAttributeSingle : ENIP.Set_Attribute_Single ;&lt;br/&gt;
    strHostnameToSet   : STRING64 := (sString := 'NewName');&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: TYPE_STRING64_Error.jpg" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=3685"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>