<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Creating control program </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8741085fd0/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8741085fd0/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/8741085fd0/</id><updated>2022-07-12T22:11:11.696000Z</updated><subtitle>Recent posts to Creating control program </subtitle><entry><title>Creating control program </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8741085fd0/?limit=25#ec82" rel="alternate"/><published>2022-07-12T22:11:11.696000Z</published><updated>2022-07-12T22:11:11.696000Z</updated><author><name>fajean</name><uri>https://forge.codesys.com/u/fajean/</uri></author><id>https://forge.codesys.coma253424751b38d299f8920d9e4f7d033af469206</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You are looking for ways to pass arguments by reference rather than value.&lt;/p&gt;
&lt;p&gt;Google "CODESYS VAR_IN_OUT".&lt;/p&gt;
&lt;p&gt;You can also define VAR_INPUT variables in functions blocks and functions that are of type "REFERENCE TO X", where "X" is the type you want to pass by reference. Since you are passing a reference, it does not matter that it is defined as an input, you will be able to act on the "thing" that is passed as a reference, not on a copy. I do everything in structured text and do not use VAR_INPUT to visually connect function blocks in diagrams, and that is what I use for everything, for reasons that I have forgotten about, probably because there were hassles from the compiler with VAR_IN_OUT.&lt;/p&gt;
&lt;p&gt;Reference assignment requires the "REF=" operator, because the normal assignment operator does a memory copy with references.&lt;/p&gt;
&lt;p&gt;You can also use pointers (POINTER TO X). This is (to me) less clean, but they work as you would expect pointers to work, in a few cases they work where references do not.  Copying a pointer to another pointer uses the normal assignment operator, because pointers are addresses. Dereferencing a pointer uses the "^" operator (e.g. "my_struct^.member_variable := 1).&lt;/p&gt;
&lt;p&gt;All of the above work with function blocks and structures.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Creating control program </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8741085fd0/?limit=25#9d7d" rel="alternate"/><published>2022-07-12T18:21:14.536000Z</published><updated>2022-07-12T18:21:14.536000Z</updated><author><name>aivarasutkus</name><uri>https://forge.codesys.com/u/aivarasutkus/</uri></author><id>https://forge.codesys.comd27578adc00e6626d1c2535dd26917c5c9a3107d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi.&lt;br/&gt;
Im working with ABB AC500 series in Automation Builder V2.5. How do you implement function or function block in codesys with user data structure as a parameter. I was working with siemens TIA portal and there you have Data blocks and in functions called IN/OUT type where you can both read, process and write back variables. Or you do this in other way in this software? I was thinking about creating my User data type and store objects in global variables table.&lt;br/&gt;
Thanks. &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>