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

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>Procyon AVRlib: pulse.h Source File</title>
4 <link href="dox.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.4.2 -->
7 <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>
8 <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>
9 00002 <span class="comment">//*****************************************************************************</span>
10 00003 <span class="comment">//</span>
11 00004 <span class="comment">// File Name : 'pulse.h'</span>
12 00005 <span class="comment">// Title : Pulse/frequency generation function library</span>
13 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2000-2002</span>
14 00007 <span class="comment">// Created : 2002-08-19</span>
15 00008 <span class="comment">// Revised : 2003-05-29</span>
16 00009 <span class="comment">// Version : 0.7</span>
17 00010 <span class="comment">// Target MCU : Atmel AVR Series</span>
18 00011 <span class="comment">// Editor Tabs : 4</span>
19 00012 <span class="comment">//</span><span class="comment"></span>
20 00013 <span class="comment">/// \ingroup driver_avr</span>
21 00014 <span class="comment">/// \defgroup pulse Pulse/Frequency Generation Function Library (pulse.c)</span>
22 00015 <span class="comment">/// \code</span>
23 00016 <span class="comment">/// #include "timer.h"</span>
24 00017 <span class="comment">/// #include "pulse.h"</span>
25 00018 <span class="comment">/// \endcode</span>
26 00019 <span class="comment">/// \par Overview</span>
27 00020 <span class="comment">/// This library is designed to facilitate the output of square wave pulses</span>
28 00021 <span class="comment">/// at a frequency determined by the user. The user may specify a continuous</span>
29 00022 <span class="comment">/// stream of pulses, or a certain fixed number. Common uses include stepper</span>
30 00023 <span class="comment">/// motor speed control, tone generation, communications, etc. The library</span>
31 00024 <span class="comment">/// uses the AVR processor built-in timers and pulse output is on the timer</span>
32 00025 <span class="comment">/// Output Compare (OC) pins. This library requires the timer function</span>
33 00026 <span class="comment">/// library to work.</span>
34 00027 <span class="comment">///</span>
35 00028 <span class="comment">/// The allowable range of frequencies which can be generated is governed</span>
36 00029 <span class="comment">/// by the tic rate of the timer (therefore the CPU clock rate and the</span>
37 00030 <span class="comment">/// timer prescaler), and the computing speed of the processor itself. See</span>
38 00031 <span class="comment">/// the SetFreq commands for more details.</span>
39 00032 <span class="comment">///</span>
40 00033 <span class="comment">/// \Note In order for the pulse library to work, pulseInit() will attach</span>
41 00034 <span class="comment">/// the pulse service routines to the timer interrupts using the</span>
42 00035 <span class="comment">/// timerAttach function. You must not detach the service routines during</span>
43 00036 <span class="comment">/// pulse library operation.</span>
44 00037 <span class="comment"></span><span class="comment">//</span>
45 00038 <span class="comment">// This code is distributed under the GNU Public License</span>
46 00039 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>
47 00040 <span class="comment">//</span>
48 00041 <span class="comment">//*****************************************************************************</span>
49 00042
50 00043 <span class="preprocessor">#ifndef PULSE_H</span>
51 00044 <span class="preprocessor"></span><span class="preprocessor">#define PULSE_H</span>
52 00045 <span class="preprocessor"></span>
53 00046 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
54 00047
55 00048 <span class="comment">// constants/macros/typdefs</span>
56 00049
57 00050 <span class="comment">// functions</span>
58 00051
59 00052 <span class="comment">// Master Pulse Commands</span>
60 00053 <span class="comment">// pulseInit()</span>
61 00054 <span class="comment">// Initializes the pulse system/library.</span>
62 00055 <span class="keywordtype">void</span> pulseInit(<span class="keywordtype">void</span>);
63 00056
64 00057 <span class="comment">// Pulse commands for timer1</span>
65 00058 <span class="comment">// pulseT1Init()</span>
66 00059 <span class="comment">// configures the timer1 hardware to produce pulses on pins OC1A and OC1B.</span>
67 00060 <span class="comment">// A "pulse" is considered to be one high and low period of a square wave.</span>
68 00061 <span class="keywordtype">void</span> pulseT1Init(<span class="keywordtype">void</span>);
69 00062
70 00063 <span class="comment">// pulseT1Off()</span>
71 00064 <span class="comment">// Turns pulse output off immediately (cancels running pulse operations).</span>
72 00065 <span class="comment">// Unconfigures hardware and interrupts.</span>
73 00066 <span class="keywordtype">void</span> pulseT1Off(<span class="keywordtype">void</span>);
74 00067
75 00068 <span class="comment">// pulseT1ASetFreq() and pulseT1BSetFreq()</span>
76 00069 <span class="comment">// sets the frequency in hertz for each channel of square-wave pulse output</span>
77 00070 <span class="comment">// Note1: the freqency &lt;freqHz&gt; must always be greater than zero</span>
78 00071 <span class="comment">// Note2: both channels share the same frequency range which is governed</span>
79 00072 <span class="comment">// by the timer1 prescaler setting. A prescaler setting of DIV/8 allows</span>
80 00073 <span class="comment">// frequencies of a few hertz through a few kilohertz.</span>
81 00074 <span class="comment">//</span>
82 00075 <span class="comment">// Lower frequency bound = overflow rate of timer1 at current prescaling</span>
83 00076 <span class="comment">// Upper frequency bound = the tics rate of timer1 at current prescaling,</span>
84 00077 <span class="comment">// or approx. the (clock rate of the processor)/50,</span>
85 00078 <span class="comment">// whichever is smaller</span>
86 00079 <span class="keywordtype">void</span> pulseT1ASetFreq(u16 freqHz);
87 00080 <span class="keywordtype">void</span> pulseT1BSetFreq(u16 freqHz);
88 00081
89 00082 <span class="comment">// pulseT1ARun() and pulseT1BRun();</span>
90 00083 <span class="comment">// Sets the number of square-wave pulses to be output on the given channel.</span>
91 00084 <span class="comment">// For continuous (unlimited) pulse output, use nPulses = 0. Pulses begin</span>
92 00085 <span class="comment">// coming out immediately.</span>
93 00086 <span class="comment">// Note: &lt;nPulses&gt; must be between 0 and 32767</span>
94 00087 <span class="keywordtype">void</span> pulseT1ARun(u16 nPulses);
95 00088 <span class="keywordtype">void</span> pulseT1BRun(u16 nPulses);
96 00089
97 00090 <span class="comment">// pulseT1AStop() and pulseT1BStop();</span>
98 00091 <span class="comment">// Stop pulse output at the next cycle (regardless of the number of</span>
99 00092 <span class="comment">// remaining pulses).</span>
100 00093 <span class="keywordtype">void</span> pulseT1AStop(<span class="keywordtype">void</span>);
101 00094 <span class="keywordtype">void</span> pulseT1BStop(<span class="keywordtype">void</span>);
102 00095
103 00096 <span class="comment">// pulseT1ARemaining() and pulseT1BRemaining()</span>
104 00097 <span class="comment">// Returns the number of pulses remaining to be output for each channel.</span>
105 00098 <span class="comment">// This function is useful for figuring out if the pulses are done.</span>
106 00099 u16 pulseT1ARemaining(<span class="keywordtype">void</span>);
107 00100 u16 pulseT1BRemaining(<span class="keywordtype">void</span>);
108 00101
109 00102 <span class="comment">// pulseT1AService() and pulseT1BService()</span>
110 00103 <span class="comment">// Interrupt service routines for pulse output (do not call these functions directly)</span>
111 00104 <span class="keywordtype">void</span> pulseT1AService(<span class="keywordtype">void</span>);
112 00105 <span class="keywordtype">void</span> pulseT1BService(<span class="keywordtype">void</span>);
113 00106
114 00107
115 00108 <span class="preprocessor">#endif</span>
116 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by&nbsp;
117 <a href="http://www.doxygen.org/index.html">
118 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
119 </body>
120 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3