Hi,
For this LED part, you may think of using a bo record. This allows to stay high
for a fixed time window and set back to low automatically. It would simply look
like this:
record(bo, "led")
{
field(HIGH, "2.0")
field(ZNAM, "0")
field(ONAM, "1")
}
In case you want a separate button PV, use another bo record with OUT field to
"led PP" and that's it.
I am not sure about this counter with multiple SCAN fields and the time of 2
seconds, while you're only counting up to 10.
Cheers,
Simon
On Tue, 2019-11-12 at 06:07 +0000, enum riz via Tech-talk wrote:
> Hi Mark
>
> i made a counter which works fine when i press button it starts and after a
> fixed value it stop.but whenever i press again button it didnot
> work.(Independently it works but when i merge this in my file with other code
> it didnot start with next press button)
> i am sending code please tell me how it will reset and starts again when
> button press. I want a duration of 2 seconds. Led On for 2 second and then
> off.
>
>
>
>
> record(bi, "b"){
> field(SCAN, ".1 second")
> field(ZNAM, "0")
> field(ZNAM, "1")
> }
>
> record(calcout, "t"){
> field(SCAN, ".1 second")
> field(INPA, "b")
> field(CALC, "A==1?1:0")
> }
>
> record(calcout, "counter"){
> field(SCAN, ".1 second")
> field(VAL, "0")
> field(INPA, "counter")
> field(INPB, "1")
> field(INPC, "t")
> field(CALC, "C==1&&(A<=9)?(A+B):A")
> }
>
> record(calcout, "reset"){
> field(SCAN, ".1 second")
> field(INPA, "counter")
> field(CALC, "A<=9?A:0")
> }
>
>
> record(calcout, "rst"){
> field(SCAN, ".1 second")
> field(INPA, "reset")
> field(CALC, "A==1?1:0")
> }
>
> record(b0, "out"){
> field(SCAN, ".1 second")
> field(OMSL, "closed_loop")
> field(DOL, "rst")
> field(ZNAM, "0")
> field(ZNAM, "1")
> }
>
>
- References:
- Reset counter enum riz via Tech-talk
- Navigate by Date:
- Prev:
Redundancy CCExecInit command problem Tasaddaq Khan via Tech-talk
- Next:
Re: Reset counter William Layne via Tech-talk
- 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
- Navigate by Thread:
- Prev:
Reset counter enum riz via Tech-talk
- Next:
Re: Reset counter William Layne via Tech-talk
- 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
|