1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Variable SCAN Intervall and Roundoff function |
From: | [email protected] |
To: | [email protected] |
Date: | Tue, 16 Aug 2016 15:32:24 +0200 |
Hi, i have two question für a simple controlapplication. 1.) I have a calcout-record which can increase or decrease a value Now I am want to implement a simple variable SCAN-intervall to increase every 60 seconds or every hour . But I don't know which is the best way to do this and how to implement this in my application. There is a solution with the OROC-field but I don't know how to implement. This is my main-calc-record: record(calcout, "UPDOWN_" ) { field(CALC, "A:= ((D=0)?(A=0?0:(A-B))):((C<(A-B))?(A-B):((A+B)>C?C:(A+B)));A") field(INPA, "UPDOWN_.VAL PP") field(INPB, "SlewRate.VAL") field(INPC, "SETVOLTAGE_ PP") field(INPD, POWER") field(OUT, "DAC_.A PP") # write value out field(OOPT, "On Change") field(DOPT, "Use CALC") field(SCAN, ".1 second") } # set command.bit record(calcout, "DAC_" ) { field(INPA, "UPDOWN_ NPP NMS" ) field(CALC, "(A | 1024)") field(PREC, "2") field(OUT, "XXX PP NMS") } 2.) I use a voltage divider with a poti in rheostat-mode (1024 steps). Because it's non-linear I have to calculate the respective bits for a value. My record works finde: record(calc, "LINEAR_" ) { field(INPA, "LINEAR_ NPP NMS" ) field(CALC, "CALCULATION") field(PREC, "2") } How can I round off the value? Let's say my calculated value is 375,6 (steps). How can I round the result off to 375 and not 376? I want to round off all result: Example: 512,8 = 512 (noit 513) Best regards, Raul |