|
List Info
Thread: long sleep and plc_scan
|
|
| long sleep and plc_scan |

|
2006-05-29 23:21:50 |
|
Hello developpers!
Please advise me.
Which is the best among belows?
A:
while() {
plc_scan_beg();
...
sleep();
...
plc_scan_end();
}
B:
while() {
plc_scan_beg();
...
plc_scan_end();
sleep();
plc_scan_beg();
...
plc_scan_end();
}
C:
while() {
plc_scan_beg();
...
plc_scan_end();
plc_scan_beg();
sleep();
...
plc_scan_end();
}
Ikeya
|
| long sleep and plc_scan |

|
2006-05-30 04:16:00 |
Hello,
Takeshi Ikeya:
> Hello developpers!
> Please advise me.
> Which is the best among belows?
It depends on what you are using it for.
If there is no synch, then it doesn't matter - any of them
will do.
If you are using synch, then it depends on how you want
other modules to be
affected by the sleep() and how the synch is organised. The
plc_scan_beg()
and plc_scan_end() are place-holders in your code for
"start of scan" and
"end of scan" - for example, if the synch
network is waiting for "end of
scan" in your module, it is actually waiting for the
module to call the
plc_scan_end() function.
Note that there are at least three options for delays:
- using sleep, as you suggest;
- for a single fixed delay, you can use the scan_period
setting on the module;
- if you need to keep processing while the delay is in
progress, use the timer
type - start it using plc_timer_start() and check it using
plc_timer_done().
h
ttp://mat.sourceforge.net/manual/custom/timer.html
Jiri
--
Jiri Baum <jiri baum.com.au> http://www.baum.com.au/~
jiri
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the
Cost and Risk!
Fully trained technicians. The highest number of Red Hat
certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
| long sleep and plc_scan |

|
2006-05-30 07:01:06 |
Quoting Jiri Baum <jiri baum.com.au>:
> Hello,
>
> Takeshi Ikeya:
>> Hello developpers!
>> Please advise me.
>> Which is the best among belows?
>
> It depends on what you are using it for.
>
> If there is no synch, then it doesn't matter - any of
them will do.
>
> (...)
> Note that there are at least three options for delays:
>
> (...)
Jiri said it all. Without further info of what you reqlly
want to
do, we cant help you any more.
Please note that I am at a conference till the end of the
week, so
my email connection will be sporadic (and writing on an
azert keyboard
is really slow and error prone... so please forgive my
typos.)
Cheers,
Mario
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the
Cost and Risk!
Fully trained technicians. The highest number of Red Hat
certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
| long sleep and plc_scan |

|
2006-05-31 12:52:19 |
Hello Jiri.
> If there is no synch, then it doesn't matter - any of
them will do.
I don't plan to use synch.
So I 'll take method A, because it's simple.
I like this.
> - using sleep, as you suggest;
Sleep is enough, and no other chores.
But....
while() { /* while1 */
plc_scan_beg();
...
sleep(); /*300ms*/
...
plc_scan_end();
}
while() { /* while2 */
plc_scan_beg();
...
plc_scan_end();
}
If above program has scan_period = 0.01 in matplc.conf.
When Matplc goes into while2, it'll execute the loop with
scan_period=0.01.
But when MatPLC go into while1, 300ms sleep() automatically
causes task change.
Then, what the plc_scan_beg/end() do ?
Ikeya
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the
Cost and Risk!
Fully trained technicians. The highest number of Red Hat
certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
| long sleep and plc_scan |

|
2006-06-03 11:18:52 |
Hello,
> > If there is no synch, then it doesn't matter -
any of them will do.
takeshi ikeya:
> I don't plan to use synch.
> So I 'll take method A, because it's simple.
OK.
> But....
> while() { /* while1 */
> plc_scan_beg();
> ...
> sleep(); /*300ms*/
> ...
> plc_scan_end();
> }
...
> But when MatPLC go into while1, 300ms sleep()
automatically causes task
> change. Then, what the plc_scan_beg/end() do ?
Not much.
* check scan_period - already slower, nothing to do
* check synch - none configured, nothing to do
* check run/stop mode
* (re-)set the module to run at the appropriate real-time
priority (if any)
Jiri
--
Jiri Baum <jiri baum.com.au> http://www.baum.com.au/~
jiri
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
| long sleep and plc_scan |

|
2006-06-03 12:09:17 |
Hello Jiri.
> > change. Then, what the plc_scan_beg/end() do ?
>
> Not much.
Then...I can omit plc_scan_beg/end()?
Ikeya
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
| long sleep and plc_scan |

|
2006-06-03 12:34:11 |
Hello,
takeshi ikeya:
> > > change. Then, what the plc_scan_beg/end() do
?
Jiri
> > Not much.
takeshi ikeya:
> Then...I can omit plc_scan_beg/end()?
Yes. They are optional.
Jiri
--
Jiri Baum <jiri baum.com.au> http://www.baum.com.au/~
jiri
_______________________________________________
MAT-devel mailing list
MAT-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mat-devel
|
|
[1-7]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|