Threads VS Timers
#1
Posted 12 April 2011 - 12:49 PM
#2
Posted 12 April 2011 - 01:00 PM
#3
Posted 12 April 2011 - 01:03 PM
- Michel Trahan likes this
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#4
Posted 12 April 2011 - 01:23 PM
We have to work on a tutorial section ! Thanks for sharing this one !See this tutorial for details
#5
Posted 12 April 2011 - 01:40 PM
#6
Posted 12 April 2011 - 02:01 PM
@Stefan - I like that InterruptPort, it would make life a lot easier. All the input plugins so far are passive however. I'm planning on just reading a pin on a set interval to gather data. (i.e. Read temp once an hour) so can I still use the InterruptPort? I could add the interrupt and use that to trigger my output plugins, but I still need to poll the input plugins.
@Michel - You're right, I was thinking a thread per input was overkill, but some plugins will have different interval times (i.e. temp every hour, but pH may be every 6 hours or more)
@Chris - Eventually I'd like to put an LCD shield on for live conditions, so I'll have to look at the WPF stuff then.
Seeing as I'm leaning towards much longer time frames, would an additional clock (a la this one) be worth looking at?
#7
Posted 12 April 2011 - 02:06 PM
The interruptport just triggers an event when the inputport changes value, nothing more, nothing less.Thanks for all the quick feedback.
@Stefan - I like that InterruptPort, it would make life a lot easier. All the input plugins so far are passive however. I'm planning on just reading a pin on a set interval to gather data. (i.e. Read temp once an hour) so can I still use the InterruptPort? I could add the interrupt and use that to trigger my output plugins, but I still need to poll the input plugins.
If you want to read a temperature once an hour it's perhaps not the best solution.
You could use a timer, see http://msdn.microsof...ercallback.aspx for more about that, but as stated earlier, timers aren't 100% precise I've read somewere else. If it's not life depended that it's a couple of seconds wrong, the timer classes can be useful.
- Michel Trahan likes this
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 12 April 2011 - 02:14 PM
That's what I was leaning towards. However, the example code is exactly the code I need.The interruptport just triggers an event when the inputport changes value, nothing more, nothing less.
If you want to read a temperature once an hour it's perhaps not the best solution.
You could use a timer, see http://msdn.microsof...ercallback.aspx for more about that, but as stated earlier, timers aren't 100% precise I've read somewere else. If it's not life depended that it's a couple of seconds wrong, the timer classes can be useful.
Thanks again.
#9
Posted 22 April 2011 - 08:18 PM
#10
Posted 23 April 2011 - 07:15 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users