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 / 2297
2296  |  2298
Subject: 
Re: System Interrupts & frequency counting
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Mon, 9 Jun 1997 17:23:42 GMT
Original-From: 
Mike Ross <MROSS@OUTLAND.stopspammersJSC.NASA.GOV>
Viewed: 
1409 times
  
On Mon, 9 Jun 1997, Paul Mrozowski wrote:

  I'm in the middle of planning/writing a small program that will read a
digital input to determine it's frequency & pulse width. I thought it'd be
nice to have this part of the program (in assembly) running off the system
interrupt so that these various freqs. & PW are available "transparently"
to my C program (by passing the results into a C Global variable). The one
issue I'm wondering about is how my code will be affected if it is
executing still when the system generates an interrupt. For example, my
code is attempting to measure the freq. of an input. If the freq. is lower
than 1000 Hz (which is the sysint. freq.) my code will still be executing
when sysint. grabs control and gives it to the next routine. Will it return
safely to my code where it left off? Do I even have to worry about this? Or
should I just call my routine directly from C when I need a value? How will
all the other interrupts affect my accuracy? Should I just code the entire
program is assembly (which I >really< don't want to do since C makes some
things really easy to do).

Paul,

What you want to do is easy.  All you need to do is get a small assembler
routine which uses the Input Capture feature.  Set the IC via registers to
trigger when a rising pulse begins, it will stash the time and strigger an
interrupt.  Then set it for a falling edge, let it capture that time, and
difference the two times to get a pulse length.  For frequencies, you
might want to just trigger on one edge, and increment a counter each time
the interrupt fires.  There's also the Pulse Accumulator line to do this.
Either way, the code is short, quick, and takes very little overhead.  The
hardest thing to do is ironing out the process of getting a piece of
assembler code compiled and linked with the IC routines.

You absolutely need the Motorola pink book on the 68HC11.  Look up in the
Handyboard resources on the Web to find out where to get one.  If you call
Motorola and sound rich and important, they might send it free.  Tell 'em
you're such an important director of purchasing, you don't have time to
cut a check.  :-)

I have some sample code if you need it.

-mike



* Michael L. Ross/C33 | Lockheed Martin Eng & Sci Svcs Co. ****
* Robotics Department | 2400 Nasa Rd. 1, Houston, TX 77058*****
* (281)333-7094; (281)333-6071 fax*    #include <disclaimer.h>*
* Finger me for my public key.  mross@outland.jsc.nasa.gov ****



Message is in Reply To:
  System Interrupts & frequency counting
 
I'm in the middle of planning/writing a small program that will read a digital input to determine it's frequency & pulse width. I thought it'd be nice to have this part of the program (in assembly) running off the system interrupt so that these (...) (27 years ago, 9-Jun-97, 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