EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  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  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: A db question about aiExample
From: Benjamin Franksen <[email protected]>
To: [email protected]
Date: Thu, 20 Nov 2008 13:57:42 +0100
On Thursday 20 November 2008 11:57, marco_hair wrote:
> Dear all:
>
>   in the aiExample.db coming with soft ioc template,
> record(ai, "$(user):aiExample")
> {
> 	field(DESC, "Analog input")
> 	field(INP, "$(user):calcExample.VAL  NPP NMS")
> 	field(EGUF, "10")
> 	field(EGU, "Counts")
> 	field(HOPR, "10")
> 	field(LOPR, "0")
> 	field(HIHI, "8")
> 	field(HIGH, "6")
> 	field(LOW, "4")
> 	field(LOLO, "2")
> 	field(HHSV, "MAJOR")
> 	field(HSV, "MINOR")
> 	field(LSV, "MINOR")
> 	field(LLSV, "MAJOR")
> }
> record(calc, "$(user):calcExample")
> {
> 	field(DESC, "Counter")
> 	field(SCAN,"1 second")
> 	field(FLNK, "$(user):aiExample")
> 	field(CALC, "(A<B)?(A+C):D")
> 	field(INPA, "$(user):calcExample.VAL  NPP NMS")
> 	field(INPB, "9")
> 	field(INPC, "1")
> 	field(INPD, "0")
> 	field(EGU, "Counts")
> 	field(HOPR, "10")
> 	field(HIHI, "8")
> 	field(HIGH, "6")
> 	field(LOW, "4")
> 	field(LOLO, "2")
> 	field(HHSV, "MAJOR")
> 	field(HSV, "MINOR")
> 	field(LSV, "MINOR")
> 	field(LLSV, "MAJOR")
> }
> the ai value will change from 0-9 and then loop from 0 again.
> if I want to generate the value from 0-9, then decrease it, such as 9-0.
> That is, the value increase from 0-9, then decrease from 9-0 one by one,
> how can I written it? Thanks a lot for your help.

You need at least one more record because the calc record can remember only 
one value. For counting up and down you need two: the current value of the 
counter and whether you are ramping up or down. I'd say add another calc 
record, something like this (untested, but you should get the idea):

record(calc, "$(user):upOrDown")
{
	field(CALC, "(A==B)?(-1):((A==D)?1:A)")
	field(INPA, "$(user):calcExample.VAL CPP")
	field(INPB, "$(user):calcExample.B CPP") # high limit
	field(INPD, "$(user):calcExample.D CPP") # low limit
}

and change INPD of $(user):calcExample to

	field(INPC,"$(user):upOrDown CPP") # increment

Cheers
Ben
-- 
"Programming = Mathematics + Murphy's Law" (E.W.Dijkstra)

Any text below this line has automatically been added by the
mail server and does not necessarily represent my personal opinion.

Helmholtz-Zentrum Berlin fÃr Materialien und Energie GmbH
Glienicker StraÃe 100, 14109 Berlin
Vorsitzende des Aufsichtsrates: Dr. Beatrix Vierkorn-Rudolph
Stellvertretende Vorsitzende: Dr. Jutta Koch-Unterseher
GeschÃftsfÃhrer: Prof. Dr. Anke Rita Pyzalla, Prof. Dr. Michael Steiner, Dr. Ulrich Breuer
Sitz der Gesellschaft: Berlin Handelsregister: AG Charlottenburg, 89 HRB 5583

Information:
Durch die Fusion mit dem ehemaligen Hahn-Meitner-Institut (HMI) ist BESSY nun Teil des neuen Helmholtz-Zentrum Berlin fÃr Materialien und Energie (HZB). Die Fusion wird im Januar 2009 vollzogen sein.

By the merger with the former Hahn-Meitner-Institut (HMI), BESSY became part of the new Helmholtz-Zentrum Berlin fÃr Materialien und Energie (HZB). The merger will be completed by January 2009.


Disclaimer automatically attached by the E-Mail Security Appliance mail0.bessy.de 11/20/08 at Helmholtz-Zentrum Berlin GmbH. 


References:
A db question about aiExample marco_hair

Navigate by Date:
Prev: Re: caPutLogging Documentation Matthias Clausen
Next: Re: A db question about aiExample Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: A db question about aiExample Owens, PH (Peter)
Next: Re: A db question about aiExample Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·