Hi Oleg,
On Monday 16 March 2009 16:43:26 Oleg Makarov wrote:
>
> It is strange though that it does not work without explicit pvFlush()
> calls. If "+a" option is not set for snc compiler, one would expect
> synchronous IO to be performed.
I suspect part of the problem might be that you're calling epicsThreadSleep()
inside the action statements, which completely freezes the sequence program
during that delay period. This almost always turns out to be the wrong thing
to do since the sequence program can't break out of that delay if something
unexpected happens. You should instead call the delay() function inside a
when() statement, which also permits the sequencer to perform other actions
while it's waiting. I would recommend changing your program to look more
like this instead (not tested), which might help:
ss main {
state init {
when (pvConnectCount() == pvChannelCount()) {
} state connected
}
state connected {
when (1)
strcpy(str_cmd, "I522");
pvPut(str_cmd);
pvFlush();
} state action522
}
state action522 {
when (delay(1.0)) {
pvGet(str_rsp);
} state getting
}
state getting {
when (delay(1.0)) {
printf("str_rsp = %s \n", str_rsp);
strcpy(str_cmd, "I521");
pvPut(str_cmd);
pvFlush();
} state action521
}
state action521 {
when (pvConnectCount() != pvChannelCount()) {
} state init
when (delay(1.0)) {
} state connected
}
}
Note that you can easily add the ability to react to channel disconnection in
the action522 and getting states if you wish.
- Andrew
--
The best FOSS code is written to be read by other humans -- Harold Welte
- References:
- weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
- Re: weird behaviour of SNL test program running on Soft IOC on LINUX J. Lewis Muir
- Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
- Navigate by Date:
- Prev:
Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
- Next:
Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
- 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:
Re: weird behaviour of SNL test program running on Soft IOC on LINUX Oleg Makarov
- Next:
Re: weird behaviour of SNL test program running on Soft IOC on LINUX Pete Jemian
- 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
|