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 / 6555
6554  |  6556
Subject: 
Re: Millisecond timing
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 30 Jul 1999 16:11:53 GMT
Original-From: 
Gary Livick <glivick@pacbell!avoidspam!.net>
Viewed: 
871 times
  
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.  You can use one of the input
capture ports, which are hardware implementations that run outside the
processor, to generate an interrupt when you get a pulse you want to
catch.  The interrupt will need to be written as an assembly file, and
run as a .icb file.  Using this method, I've been able to time things
that are 100 microseconds wide.

Another way is to write in assembly to begin with, and load the code
using PCbug or some other software device.  That should be much faster
yet, and in fact by using the tables in one of the Motorolla manuals,
you can actually add up the execution times of each step in your
assembly routine and know the exact timing.

The bottom line, and the answer to your question, is you can't get there
with IC directly as it executes too slowly.  The problem is not with the
Handy Board, it is with the fact that IC is interpreted by a runtime
software package that lives in ram called the Pcode interpreter.  It
works great for most things, and allows workarounds for things that are
to fast to be handled directly.

Hope this isn't too much info.....

Best regards,

Gary Livick





"Landahl, Bill" wrote:



        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; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Content-Length: 5517



Message is in Reply To:
  Millisecond timing
 
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 (...) (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