?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{FILE START}

library

?curdirlinks? - Rev 6

?prevdifflink? - Blame - ?getfile?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Procyon AVRlib: pulse.h Source File</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>pulse.h</h1><a href="pulse_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file pulse.h \brief Pulse/frequency generation function library. */</span>
00002 <span class="comment">//*****************************************************************************</span>
00003 <span class="comment">//</span>
00004 <span class="comment">// File Name    : 'pulse.h'</span>
00005 <span class="comment">// Title        : Pulse/frequency generation function library</span>
00006 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2000-2002</span>
00007 <span class="comment">// Created      : 2002-08-19</span>
00008 <span class="comment">// Revised      : 2003-05-29</span>
00009 <span class="comment">// Version      : 0.7</span>
00010 <span class="comment">// Target MCU   : Atmel AVR Series</span>
00011 <span class="comment">// Editor Tabs  : 4</span>
00012 <span class="comment">//</span><span class="comment"></span>
00013 <span class="comment">/// \ingroup driver_avr</span>
00014 <span class="comment">/// \defgroup pulse Pulse/Frequency Generation Function Library (pulse.c)</span>
00015 <span class="comment">/// \code</span>
00016 <span class="comment">///     #include "timer.h"</span>
00017 <span class="comment">///     #include "pulse.h"</span>
00018 <span class="comment">/// \endcode</span>
00019 <span class="comment">/// \par Overview</span>
00020 <span class="comment">///     This library is designed to facilitate the output of square wave pulses</span>
00021 <span class="comment">/// at a frequency determined by the user.  The user may specify a continuous</span>
00022 <span class="comment">/// stream of pulses, or a certain fixed number. Common uses include stepper</span>
00023 <span class="comment">/// motor speed control, tone generation, communications, etc.  The library</span>
00024 <span class="comment">/// uses the AVR processor built-in timers and pulse output is on the timer</span>
00025 <span class="comment">/// Output Compare (OC) pins.  This library requires the timer function</span>
00026 <span class="comment">/// library to work.</span>
00027 <span class="comment">///</span>
00028 <span class="comment">/// The allowable range of frequencies which can be generated is governed</span>
00029 <span class="comment">/// by the tic rate of the timer (therefore the CPU clock rate and the</span>
00030 <span class="comment">/// timer prescaler), and the computing speed of the processor itself. See</span>
00031 <span class="comment">/// the SetFreq commands for more details.</span>
00032 <span class="comment">///</span>
00033 <span class="comment">/// \Note In order for the pulse library to work, pulseInit() will attach</span>
00034 <span class="comment">/// the pulse service routines to the timer interrupts using the</span>
00035 <span class="comment">/// timerAttach function. You must not detach the service routines during</span>
00036 <span class="comment">/// pulse library operation.</span>
00037 <span class="comment"></span><span class="comment">//</span>
00038 <span class="comment">// This code is distributed under the GNU Public License</span>
00039 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>
00040 <span class="comment">//</span>
00041 <span class="comment">//*****************************************************************************</span>
00042 
00043 <span class="preprocessor">#ifndef PULSE_H</span>
00044 <span class="preprocessor"></span><span class="preprocessor">#define PULSE_H</span>
00045 <span class="preprocessor"></span>
00046 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
00047 
00048 <span class="comment">// constants/macros/typdefs</span>
00049 
00050 <span class="comment">// functions</span>
00051 
00052 <span class="comment">// Master Pulse Commands</span>
00053 <span class="comment">// pulseInit()</span>
00054 <span class="comment">//      Initializes the pulse system/library.</span>
00055 <span class="keywordtype">void</span> pulseInit(<span class="keywordtype">void</span>);
00056 
00057 <span class="comment">// Pulse commands for timer1</span>
00058 <span class="comment">// pulseT1Init()</span>
00059 <span class="comment">//      configures the timer1 hardware to produce pulses on pins OC1A and OC1B.</span>
00060 <span class="comment">//      A "pulse" is considered to be one high and low period of a square wave.</span>
00061 <span class="keywordtype">void</span> pulseT1Init(<span class="keywordtype">void</span>);
00062 
00063 <span class="comment">// pulseT1Off()</span>
00064 <span class="comment">//      Turns pulse output off immediately (cancels running pulse operations).</span>
00065 <span class="comment">//      Unconfigures hardware and interrupts.</span>
00066 <span class="keywordtype">void</span> pulseT1Off(<span class="keywordtype">void</span>);
00067 
00068 <span class="comment">//  pulseT1ASetFreq() and pulseT1BSetFreq()</span>
00069 <span class="comment">//      sets the frequency in hertz for each channel of square-wave pulse output</span>
00070 <span class="comment">//      Note1: the freqency &lt;freqHz&gt; must always be greater than zero</span>
00071 <span class="comment">//      Note2: both channels share the same frequency range which is governed</span>
00072 <span class="comment">//      by the timer1 prescaler setting.  A prescaler setting of DIV/8 allows</span>
00073 <span class="comment">//      frequencies of a few hertz through a few kilohertz.</span>
00074 <span class="comment">//</span>
00075 <span class="comment">//      Lower frequency bound = overflow rate of timer1 at current prescaling</span>
00076 <span class="comment">//      Upper frequency bound = the tics rate of timer1 at current prescaling,</span>
00077 <span class="comment">//                              or approx. the (clock rate of the processor)/50,</span>
00078 <span class="comment">//                              whichever is smaller</span>
00079 <span class="keywordtype">void</span> pulseT1ASetFreq(u16 freqHz);
00080 <span class="keywordtype">void</span> pulseT1BSetFreq(u16 freqHz);
00081 
00082 <span class="comment">// pulseT1ARun() and pulseT1BRun();</span>
00083 <span class="comment">//      Sets the number of square-wave pulses to be output on the given channel.</span>
00084 <span class="comment">//      For continuous (unlimited) pulse output, use nPulses = 0.  Pulses begin</span>
00085 <span class="comment">//      coming out immediately.</span>
00086 <span class="comment">//      Note: &lt;nPulses&gt; must be between 0 and 32767</span>
00087 <span class="keywordtype">void</span> pulseT1ARun(u16 nPulses);
00088 <span class="keywordtype">void</span> pulseT1BRun(u16 nPulses);
00089 
00090 <span class="comment">// pulseT1AStop() and pulseT1BStop();</span>
00091 <span class="comment">//      Stop pulse output at the next cycle (regardless of the number of</span>
00092 <span class="comment">//      remaining pulses).</span>
00093 <span class="keywordtype">void</span> pulseT1AStop(<span class="keywordtype">void</span>);
00094 <span class="keywordtype">void</span> pulseT1BStop(<span class="keywordtype">void</span>);
00095 
00096 <span class="comment">// pulseT1ARemaining() and pulseT1BRemaining()</span>
00097 <span class="comment">//      Returns the number of pulses remaining to be output for each channel.</span>
00098 <span class="comment">//      This function is useful for figuring out if the pulses are done.</span>
00099 u16  pulseT1ARemaining(<span class="keywordtype">void</span>);
00100 u16  pulseT1BRemaining(<span class="keywordtype">void</span>);
00101 
00102 <span class="comment">// pulseT1AService() and pulseT1BService()</span>
00103 <span class="comment">//      Interrupt service routines for pulse output (do not call these functions directly)</span>
00104 <span class="keywordtype">void</span> pulseT1AService(<span class="keywordtype">void</span>);
00105 <span class="keywordtype">void</span> pulseT1BService(<span class="keywordtype">void</span>);
00106 
00107 
00108 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3