To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3176
3175  |  3177
Subject: 
Accurate Timing
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics.rcx.legos
Date: 
Fri, 28 Feb 2003 01:50:00 GMT
Viewed: 
510 times
  
Hello!

I just started using brickOS and am trying to use it as a programmable function
generator.  As such, I'm trying to get good repeatability on cycle time.

It appears that at 'random' times, the RCX scheduler(?) is interrupting my
program to do task maintenance.  I would like the scheduler to run during the
time when my output is high, but finish before my output must go low again, so
as not to maintain repeatability.

How can I achieve this behavior?  Does it involve setting priorities on tasks?
If so, how do I set the priority of the 'main' task or the scheduler?

My simple program is below for your reference.  Please get back to me at your
earliest convenience, as I have to have this ready by tomorrow noon.  Thank
you!

Sincerely,
Neville Bonwit

----------------------------------------
#include <config.h>
#include <conio.h>
#include <unistd.h>
#include <tm.h>

#include <c++/Motor.H>

int
main(int argc,
     char **argv)
{
  Motor mA(Motor::A);
  Motor mB(Motor::B);

  mA.speed(mA.max);
  mB.speed(mB.max);

  while(true)
  {
    mA.forward();
    msleep(1);
    mA.brake();
    msleep(1);

    mB.forward();
    msleep(1);
    mB.brake();
    msleep(1);
   }

  cls();

  return 0;
}



1 Message 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