<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/</id><updated>2020-04-14T10:32:02.960000Z</updated><subtitle>Recent posts to type conversion from ANY_NUM to REAL don't work </subtitle><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=25#7b36" rel="alternate"/><published>2020-04-14T10:32:02.960000Z</published><updated>2020-04-14T10:32:02.960000Z</updated><author><name>mkrispin</name><uri>https://forge.codesys.com/u/mkrispin/</uri></author><id>https://forge.codesys.com7559cfc124cbd713622657a3befad9de7ddbf548</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi All,&lt;br/&gt;
thank you very much for your help. I think I understand now how that works with the pointer .&lt;br/&gt;
I'm wondering only because I have used ANY at other parts without any problem.&lt;br/&gt;
Where I run now into a compiler error , I will implement the pointer solution, but is not a quick short code anymore :-(&lt;br/&gt;
Best Regards&lt;br/&gt;
Michael&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=250#b5ed/cb51" rel="alternate"/><published>2020-04-14T07:10:41.004000Z</published><updated>2020-04-14T07:10:41.004000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com732ec75a6f3e8b437730849f29b7d661dd9c2c13</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use CfUnit for that.&lt;br/&gt;
it is open source so you take a look at the code too&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=25#fe42" rel="alternate"/><published>2020-04-14T05:41:30.095000Z</published><updated>2020-04-14T05:41:30.095000Z</updated><author><name>Thomas</name><uri>https://forge.codesys.com/u/thk/</uri></author><id>https://forge.codesys.combe7c574a9bbae622474b729dbab0764fa17cd1bd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hey, the struct have a pointer and a value == &amp;gt;&amp;gt; see attachment&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=25#b5ed" rel="alternate"/><published>2020-04-10T03:25:46.250000Z</published><updated>2020-04-10T03:25:46.250000Z</updated><author><name>mkrispin</name><uri>https://forge.codesys.com/u/mkrispin/</uri></author><id>https://forge.codesys.com7a2b4d5e8d3e6117b7260938c37ea12b91f23ea8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi i-campbell, thanks for your answer. I had checked that description of ANY, but it does not help me further.&lt;br/&gt;
I thought when I write does anyone have an idea what is wrong do implicate that I look also for a solution.&lt;br/&gt;
So, I will precise my question: How can I get the required function with any even combined number type (INT,WORD,REAL) to compare if a value is in between a range.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=25#21d7" rel="alternate"/><published>2020-04-09T20:36:53.718000Z</published><updated>2020-04-09T20:36:53.718000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.com25a8a4acda765341daea752d3da73e22ac204dcf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So ANY_* gives you a special struct, see more &lt;a class="" href="https://help.codesys.com/webapp/_cds_datatype_any;product=codesys;version=3.5.15.0#predefined-structure" rel="nofollow"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>type conversion from ANY_NUM to REAL don't work </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/db5b4051fa/?limit=25#cd16" rel="alternate"/><published>2020-04-09T19:46:50.516000Z</published><updated>2020-04-09T19:46:50.516000Z</updated><author><name>mkrispin</name><uri>https://forge.codesys.com/u/mkrispin/</uri></author><id>https://forge.codesys.com50efbee3fa3db81cf6802a45bb9abaaa707515cf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I would like to create a simple function to compare if a value is like Value in between or equal to two limits, similar to the standard comparism functions LE or GE&lt;/p&gt;
&lt;p&gt;In principal the function look like:&lt;br/&gt;
OUT := (nIN &amp;gt;= nLo) And (nIN &amp;lt;= nHi)&lt;br/&gt;
All input parameters nIN, nLo, nHi are declared as ANY_NUM&lt;/p&gt;
&lt;p&gt;FUNCTION BTWEQ&lt;br/&gt;
VAR_INPUT&lt;br/&gt;
    nIN : ANY_NUM;&lt;br/&gt;
    nLO : ANY_NUM;&lt;br/&gt;
    nHI : ANY_NUM;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;BTWEQ := (nIN &amp;gt;= nLO) AND (nIN &amp;lt;= nHI);&lt;/p&gt;
&lt;p&gt;In Library Util is a FB LIMIT_ALARM which do that what I want, but is limited to Integer values. I would like to have the function generic for any numeric data type.&lt;br/&gt;
I get always a failure like  'Cannot convert type SYSTEM.AnyType to type Any &lt;/p&gt;
&lt;p&gt;I don't get it what is wrong here.&lt;br/&gt;
I tried to do a step between and wrote the Inputs explicit to local variables&lt;br/&gt;
VAR&lt;br/&gt;
    rIN : REAL;&lt;br/&gt;
    rLO : REAL;&lt;br/&gt;
    rHI : REAL;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;rIN := nIN;&lt;br/&gt;
rLO := nLO;&lt;br/&gt;
rHI := nHI;&lt;br/&gt;
BTWEQ := (rIN &amp;gt;= rLO) AND (rIN &amp;lt;= rHI);&lt;/p&gt;
&lt;p&gt;even forced type conversion did not work&lt;br/&gt;
rIN := TO_REAL(nIN);&lt;br/&gt;
rLO := TO_REAL(nLO);&lt;br/&gt;
rHI := TO_REAL(nHI);&lt;br/&gt;
BTWEQ := (rIN &amp;gt;= rLO) AND (rIN &amp;lt;= rHI);&lt;/p&gt;
&lt;p&gt;It always end with the compiler error of fail to convert the type&lt;/p&gt;
&lt;p&gt;Does anyone have an idea what is wrong?&lt;br/&gt;
Thank You and Best Regards&lt;br/&gt;
Michael&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>