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 / 6554
6553  |  6555
Subject: 
Millisecond timing
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 30 Jul 1999 12:44:25 GMT
Original-From: 
Landahl, Bill <bill.landahl@morganite&StopSpam&.com>
Viewed: 
885 times
  
I recently bought a Handy Board to use in acquiring time
measurements varying by one millisecond.  The Handy Board has a clock speed
of 2kHz, therefore it should be able to measure down to one half
millisecond.

What I have found however is that the smallest time I am measuring
is 3 millieseconds.  Ther is no code running except for the time acquisition
code.  My question is, Will it be possible for me to get the one millisecond
time accuracy I want?  Should I be using system interupts instead of just
reading system time?  If so, how do I do that?

Below is the code  I am running for the time acquisition.


int x;
int y;
float p;
float n;
float z;
void main (void)
{
   while(1) {

      if (digital(10)){              /* capture leading edge*/
         while (x < 1){
            n = seconds();
            x++;
         }
      }
      if (digital(11)){               /*capture leading edge*/
         while (y < 1){
            p = seconds();
            y++;
         }
      z = p - n;                   /*floating point math- after data
acquired*/
      printf("\nTime= %f",z);
      }

      if (start_button()){
         x=0;
         y=0;
         reset_system_time();
      }
   }
}


--
MIME ATTACHMENTS DISCARDED:

1.  Content-Type: text/html
    Content-Transfer-Encoding: quoted-printable
    Content-Length: 4169



Message has 2 Replies:
  Re: Millisecond timing
 
The clock speed on the Handy Board runs at 2 Mhz, which is plenty fast enough for most things IF you run the right code. IC, used in its C implementation is too slow to catch anything at 1 ms reliably. However, there are a few simple work arounds. (...) (25 years ago, 30-Jul-99, to lugnet.robotics.handyboard)
  Re: Millisecond timing
 
(...) See the Polaroid sonar code (from the HB web site) for an example of how to measure timing signals on the TIC3 channel. You initialize with: bit_set( 0x1009, 0x30 ); /* ddrd */ bit_set( 0x1021, 1 ); /* at tctl2, */ bit_clear( 0x1021, 2 ); /* (...) (25 years ago, 30-Jul-99, to lugnet.robotics.handyboard)

3 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