<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Generate FBs from source</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f1704210d0/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f1704210d0/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/f1704210d0/</id><updated>2024-07-31T05:02:26.492000Z</updated><subtitle>Recent posts to Generate FBs from source</subtitle><entry><title>Generate FBs from source</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f1704210d0/?limit=25#91ed" rel="alternate"/><published>2024-07-31T05:02:26.492000Z</published><updated>2024-07-31T05:02:26.492000Z</updated><author><name>askic</name><uri>https://forge.codesys.com/u/askic/</uri></author><id>https://forge.codesys.com09f2e416a1937ad93978f1a52b19c7c47cc89143</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I'm coming from Siemens (TIA) world and currently learning Codesys. &lt;br/&gt;
I'd like to know if there is an option to add external txt file with ST code for creation of a function block and then use this file as a source file from which FB will be generated?&lt;br/&gt;
For example, in TIA, there is an option add external source file to the project structure and then use option "Generate blocks from source". This would create a FB.&lt;/p&gt;
&lt;p&gt;Does Codesys have something similar?&lt;/p&gt;
&lt;p&gt;This external source file would look like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;Scaling&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;REAL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;VAR_OUTPUT&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;REAL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="kr"&gt;VAR&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_FUNCTION_BLOCK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry></feed>