Main Page   Data Structures   File List   Data Fields   Globals  

pulse.h

Go to the documentation of this file.
00001 /*! \file pulse.h \brief Pulse/frequency generation function library. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'pulse.h'
00005 // Title        : Pulse/frequency generation function library
00006 // Author       : Pascal Stang - Copyright (C) 2000-2002
00007 // Created      : 2002-08-19
00008 // Revised      : 2002-08-19
00009 // Version      : 1.1
00010 // Target MCU   : Atmel AVR Series
00011 // Editor Tabs  : 4
00012 //
00013 // This code is distributed under the GNU Public License
00014 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00015 //
00016 //
00017 // Description  :
00018 //
00019 //*****************************************************************************
00020 
00021 #ifndef PULSE_H
00022 #define PULSE_H
00023 
00024 #include "global.h"
00025 
00026 // constants/macros/typdefs
00027 
00028 // functions
00029 
00030 // Master Pulse Commands
00031 //  pulseInit()
00032 //      Initializes the pulse
00033 void pulseInit(void);
00034 
00035 
00036 // Pulse commands for timer1
00037 // pulseT1Init()
00038 //      configures the timer1 hardware to produce pulses on pins OC1A and OC1B.
00039 //      A "pulse" is considered to be one high and low period of a square wave.
00040 void pulseT1Init(void);
00041 
00042 // pulseT1Off()
00043 //      Turns pulse output off immediately (cancels running pulse operations).
00044 void pulseT1Off(void);
00045 
00046 //  pulseT1ASetFreq() and pulseT1BSetFreq()
00047 //      sets the frequency in hertz for each channel of square-wave pulse output
00048 //      Note1: the freqency <freqHz> must always be greater than zero
00049 //      Note2: both channels share the same frequency range which is governed
00050 //      by the timer1 prescaler setting.  A prescaler setting of DIV/8 allows
00051 //      frequencies of a few hertz through a few kilohertz.
00052 //
00053 //      Lower frequency bound = overflow rate of timer1 at current prescaling
00054 //      Upper frequency bound = the tics rate of timer1 at current prescaling,
00055 //                                      or approx. the (clock rate of the processor)/50,
00056 //                                      whichever is smaller
00057 void pulseT1ASetFreq(u16 freqHz);
00058 void pulseT1BSetFreq(u16 freqHz);
00059 
00060 // pulseT1ARun() and pulseT1BRun();
00061 //      Sets the number of square-wave pulses to be output on the given channel.
00062 //      Pulses begin coming out immediately.
00063 //      Note: <nPulses> must be between 0 and 32767
00064 void pulseT1ARun(u16 nPulses);
00065 void pulseT1BRun(u16 nPulses);
00066 
00067 // pulseT1ARemaining() and pulseT1BRemaining()
00068 //      Returns the number of pulses remaining to be output for each channel.
00069 //      This function is especially useful for figuring out if the pulses are done.
00070 u16  pulseT1ARemaining(void);
00071 u16  pulseT1BRemaining(void);
00072 
00073 // pulseT1AService() and pulseT1BService()
00074 //      Interrupt service routines for pulse output (do not call these functions directly)
00075 void pulseT1AService(void);
00076 void pulseT1BService(void);
00077 
00078 
00079 #endif

Generated on Tue Feb 4 20:18:37 2003 for Procyon AVRlib by doxygen1.3-rc2