To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1079
1078  |  1080
Subject: 
Which way is faster?
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 13 Apr 2001 15:59:32 GMT
Viewed: 
1836 times
  
I want to know which way is faster:
1. Use three tasks to watch sensors
task watch1()
{
  while (true) {
     if () {
        ..
     }
  }
}
task watch2()
{
while (true) {
     if () {
        ..
     }
  }
}
task watch3()
{
while (true) {
     if () {
        ..
     }
  }
}

2. Use one task with multi if-else
task watch()
{
while (true) {
     if () {
        ..
     }
     else if () {
        ..
     }
     else if () {
        ..
     }
  }
}

Zhengrong



Message has 1 Reply:
  Re: Which way is faster?
 
By "fastest", I assume you mean the smallest worst case latency between a condition happening and the RCX responding to it. Option #2 has the drawback that while the RCX is responding to one condition, it won't be looking for the other ones. So the (...) (23 years ago, 13-Apr-01, to lugnet.robotics.rcx.nqc)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR