<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Function output</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e9fb4ee514/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e9fb4ee514/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e9fb4ee514/</id><updated>2020-02-27T21:40:58.280000Z</updated><subtitle>Recent posts to Function output</subtitle><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#bae9" rel="alternate"/><published>2020-02-27T21:40:58.280000Z</published><updated>2020-02-27T21:40:58.280000Z</updated><author><name>ozenc.ugur</name><uri>https://forge.codesys.com/u/ozenc-ugur/</uri></author><id>https://forge.codesys.comea73ad38bf09faabe749eedbee981a31e46cfc60</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;It's now clear, I understand my fault. In my functions I see that had been trying to store the values in different variables. I understand that now we must store the return value as the same as the function name.&lt;/p&gt;
&lt;p&gt;Thank you very much. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#e2e8" rel="alternate"/><published>2020-02-27T21:40:56.814000Z</published><updated>2020-02-27T21:40:56.814000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com5dbd0abf061b0d08ad5c410dc928e6a6a0aa0301</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;oke i have added a program with some explanation for you.&lt;br/&gt;
In IL this is a little rusty for me.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=372" rel="nofollow"&gt;exampleadd.pro &lt;span&gt;&lt;span&gt;[27.98 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#4ae8" rel="alternate"/><published>2020-02-27T21:40:52.695000Z</published><updated>2020-02-27T21:40:52.695000Z</updated><author><name>ozenc.ugur</name><uri>https://forge.codesys.com/u/ozenc-ugur/</uri></author><id>https://forge.codesys.com34c98af1bbd87af0938854bc407e62aad15ceb2d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;in ST you express that &lt;br/&gt;
result := functionname(input1,input2);&lt;/p&gt;
&lt;p&gt;But what I can write in function to return the value that I want,&lt;/p&gt;
&lt;p&gt;For example I am writing the sample code attached as the picture.(I know I can not call the function result same as the return variable in function but I dont know how to do it) but when I simulte it result can not be send to PLC_PRG as shown in the second picture.&lt;/p&gt;
&lt;p&gt;How can I solve this problem?&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: pic2.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=371"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: pic.PNG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=370"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#d639" rel="alternate"/><published>2020-02-27T21:40:51.221000Z</published><updated>2020-02-27T21:40:51.221000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comf8eec30affe568ad05bd99002ba57407c6a01762</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;please download a file on &lt;a class="" href="http://www.oscat.de" rel="nofollow"&gt;http://www.oscat.de&lt;/a&gt;&lt;br/&gt;
you will need the LIB file and the TXT version&lt;br/&gt;
for explain take the english PDF&lt;/p&gt;
&lt;p&gt;or read simple the help file.&lt;br/&gt;
a function only has one output max.&lt;br/&gt;
you call it by using the function name&lt;br/&gt;
in ST&lt;br/&gt;
result := functionname(input1,input2);&lt;/p&gt;
&lt;p&gt;a function block can have more inputs and outputs.&lt;br/&gt;
but they need to be in the VAR list like functionblockalias: functionblockname ; (this can be done with F2&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#e973" rel="alternate"/><published>2020-02-27T21:40:47.111000Z</published><updated>2020-02-27T21:40:47.111000Z</updated><author><name>ozenc.ugur</name><uri>https://forge.codesys.com/u/ozenc-ugur/</uri></author><id>https://forge.codesys.com3cc942e9c6e1e1834e99e33cf6737aa8e3710779</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am able to call Function Blocks in PLC_PRG and use their outputs in PLC_PRG but I couldn't call them in another function block. Do you have any experience or idea about this?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#ff0e" rel="alternate"/><published>2020-02-27T21:40:45.622000Z</published><updated>2020-02-27T21:40:45.622000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comfbf8dd290428cf2121d0ee91e37f7483efc76adc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In IL it is like this.&lt;/p&gt;
&lt;p&gt;Declaration part:&lt;/p&gt;
&lt;p&gt;FUNCTION Fct: INT&lt;/p&gt;
&lt;p&gt;VAR_INPUT&lt;/p&gt;
&lt;p&gt;PAR1:INT;&lt;/p&gt;
&lt;p&gt;PAR2:INT;&lt;/p&gt;
&lt;p&gt;PAR3:INT;&lt;/p&gt;
&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;Implementation part:&lt;/p&gt;
&lt;p&gt;LD PAR1&lt;/p&gt;
&lt;p&gt;MUL PAR2&lt;/p&gt;
&lt;p&gt;DIV PAR3&lt;/p&gt;
&lt;p&gt;ST Fct&lt;/p&gt;
&lt;p&gt;and in ST it is almost same&lt;/p&gt;
&lt;p&gt;FUNCTION Fct: real&lt;/p&gt;
&lt;p&gt;VAR_INPUT&lt;/p&gt;
&lt;p&gt;PAR1:real;&lt;/p&gt;
&lt;p&gt;PAR2:real;&lt;/p&gt;
&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;Fct:=par1*par2;&lt;/p&gt;
&lt;p&gt;go to  w &lt;a class="" href="http://www.oscat.de" rel="nofollow"&gt;www.oscat.de&lt;/a&gt; w  download the library as LIB and as TXT file and you will be complete flabbergasted with knowledge.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#8217" rel="alternate"/><published>2020-02-27T21:40:44.147000Z</published><updated>2020-02-27T21:40:44.147000Z</updated><author><name>balajimct</name><uri>https://forge.codesys.com/u/balajimct/</uri></author><id>https://forge.codesys.com1f0db7ee80a2d91ffb5b137b9deedba9040ccc57</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Either you can use Function or Function Blocks to write this code, And you can use as many times as you need.&lt;/p&gt;
&lt;p&gt;If you are using function the return value should be an array variable, But if you are using FB the return value will be either array or individuals as you decide.&lt;/p&gt;
&lt;p&gt;The example of sample codes can be seen in Codesys help.&lt;/p&gt;
&lt;p&gt;Search for Function or Function Block&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function output</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e9fb4ee514/?limit=25#bb34" rel="alternate"/><published>2020-02-27T21:40:40.043000Z</published><updated>2020-02-27T21:40:40.043000Z</updated><author><name>ozenc.ugur</name><uri>https://forge.codesys.com/u/ozenc-ugur/</uri></author><id>https://forge.codesys.comc4acf6e8a97f6f693f01d3357d03a22a868abed9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, I am very new to Codesys&lt;/p&gt;
&lt;p&gt;I am trying to write a code which has lots of mathematical subfunctions. The problem is that I can not use function outputs. I can explain that as a C code, for example (as a basic one) &lt;/p&gt;
&lt;p&gt;As a pesudo code&lt;/p&gt;
&lt;p&gt;double amplified;&lt;br/&gt;
amplified=Amp(input,amplification_constant,output);&lt;/p&gt;
&lt;p&gt;Amp(double,double,double)&lt;br/&gt;
{&lt;br/&gt;
output=amplification_constant*input;&lt;br/&gt;
return output;&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;I want to write a function, then send it parameters and use its return value.&lt;/p&gt;
&lt;p&gt;It may be a very easy problem. But I don't know how to do it in ST language.&lt;/p&gt;
&lt;p&gt;If anyone may help me I would be glad.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>