To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 3094
3093  |  3095
Subject: 
Kudos for Fred, Randy, and Anne, and a lib_hb.c tweak
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Wed, 17 Dec 1997 21:49:47 GMT
Original-From: 
Bill Bynum <bynum@cs.wmSTOPSPAMMERS.edu>
Viewed: 
550 times
  
Hello, everyone:

   I want to express my appreciation to Fred Martin for the splendid
job that he's done in designing the HandyBoard and devising the
assembly instructions.  I've built nine of the HandyBoards, and
although I made a few mistakes along the way, Fred's debugging
procedures always helped me figure out what I had done wrong.

   Randy Sargent, Anne Wright, and Fred deserve praise for developing
Interactive C and modifying it for the HandyBoard.  It's a nice
way to write robot programs.

   I've been using the nine HandyBoard/LEGObugs in an undergraduate
robotics class this semester.  One of my students in that class,
Jesse Chappell, noticed a problem with the analog() routine in the
lib_hb.c file.

   Jesse was using several IR sensors on his robot for one of the
course assignments.  In his code, he had a separate process to watch
each sensor.  Jesse noticed that about every couple of seconds or so,
a bad IR reading would occur.  He eliminated the possibity of sensor
failure, then found the problem in lib_hb.c, and devised a fix.

   Here is Jesse's modification to the analog() proc.

----------------------------------------------------------------------
int analog(int port)
{
    int tmp;                  /* for value return     JLC*/
    if (port < 7)
    {
      hog_processor();        /* get CPU exclusively  JLC*/
      tmp = _raw_analog(port);
      defer();                /* release CPU          JLC*/
      return tmp;
    }
    else if (port < 16)
    {
        return 255 * !digital(port);
    }
    else
    {
        printf("Analog port out of range\n");
        beep();
        return -1;
    }
}
----------------------------------------------------------------------

   Jesse noticed that occasionally a context switch would occur just
after the two poke's in _raw_analog(), so that the analog() call of
one process would receive the peek that really belonged to another
process.  Jesse's additions to the code ensure that a context switch
cannot occur during the _raw_analog() call, so that each process
gets the its own results of the peek in _raw_analog().


      Bill Bynum
      College of William & Mary
      Department of Computer Science
      P.O. Box 8795
      Williamsburg, VA 23187-8795
      telephone:  (757) 221-3456
      fax:  (757) 221-1717
      e-mail:  bynum@cs.wm.edu



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