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 / 2515
2514  |  2516
Subject: 
sys_timer
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 3 May 2002 05:24:51 GMT
Viewed: 
2394 times
  
I recently adopted legOS as my development environment and I have to say I
tremendously impressed.  Thanks to everyone who has worked so hard on it.
It is really a first class, grade A product.

Is sys_timer accurate to within 1 ms?

    unsigned long timer_str;
    time_str = sys_time;
    wait_event(... );
    time_str = sys_time - time_str;
    lcd_int((int)timer_str);

this only seems to update by 20 ms at a time.  That doesn't really make
sense though...  I am pushing a button by hand and here is some sample
output:

220
200
1720
1400
1020
1060
280

etc....  I think you all get the point.  Any help would be appreciated



Message has 2 Replies:
  Re: sys_timer
 
(...) Yes. It is updated from an interrupt routine that fires every 1 ms (IIRC). However.... (...) wait_event is only accurate to 20ms or so, depending on what your other tasks do. So your timing is very accurate, but you're not timing what you (...) (23 years ago, 3-May-02, to lugnet.robotics.rcx.legos)
  Re: sys_timer
 
(...) Yes. (...) That is right. (...) It does, actually. The timer itself counts the millisec. But if you do a wait_event() call, your running program gives up its time slice, the OS waits for the event and then continues your task with the next (...) (23 years ago, 3-May-02, to lugnet.robotics.rcx.legos)

4 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