?? pulse_8h-source.html
字號:
<!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.3.6 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>pulse.h</h1><a href="pulse_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>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>00013 <span class="comment">// Description : This library is designed to facilitate the output of square</span>00014 <span class="comment">// wave pulses at a frequency determined by the user. The library uses</span>00015 <span class="comment">// the AVR processor built-in timers and the output is on the timer Output</span>00016 <span class="comment">// Compare (OC) pins.</span>00017 <span class="comment">//</span>00018 <span class="comment">// The allowable range of frequencies which can be generated is governed</span>00019 <span class="comment">// by the tic rate of the timer (therefore the CPU clock rate and the</span>00020 <span class="comment">// timer prescaler), and the computing speed of the processor itself. See</span>00021 <span class="comment">// the SetFreq commands for more details.</span>00022 <span class="comment">//</span>00023 <span class="comment">// NOTE: in order for the pulse library to work, pulseInit() will attach</span>00024 <span class="comment">// the pulse service routines to the timer interrupts using the</span>00025 <span class="comment">// timerAttach function. You must not detach the service routines during</span>00026 <span class="comment">// pulse library operation.</span>00027 <span class="comment">//</span>00028 <span class="comment">// This code is distributed under the GNU Public License</span>00029 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00030 <span class="comment">//</span>00031 <span class="comment">//*****************************************************************************</span>00032 00033 <span class="preprocessor">#ifndef PULSE_H</span>00034 <span class="preprocessor"></span><span class="preprocessor">#define PULSE_H</span>00035 <span class="preprocessor"></span>00036 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00037 00038 <span class="comment">// constants/macros/typdefs</span>00039 00040 <span class="comment">// functions</span>00041 00042 <span class="comment">// Master Pulse Commands</span>00043 <span class="comment">// pulseInit()</span>00044 <span class="comment">// Initializes the pulse system/library.</span>00045 <span class="keywordtype">void</span> pulseInit(<span class="keywordtype">void</span>);00046 00047 <span class="comment">// Pulse commands for timer1</span>00048 <span class="comment">// pulseT1Init()</span>00049 <span class="comment">// configures the timer1 hardware to produce pulses on pins OC1A and OC1B.</span>00050 <span class="comment">// A "pulse" is considered to be one high and low period of a square wave.</span>00051 <span class="keywordtype">void</span> pulseT1Init(<span class="keywordtype">void</span>);00052 00053 <span class="comment">// pulseT1Off()</span>00054 <span class="comment">// Turns pulse output off immediately (cancels running pulse operations).</span>00055 <span class="comment">// Unconfigures hardware and interrupts.</span>00056 <span class="keywordtype">void</span> pulseT1Off(<span class="keywordtype">void</span>);00057 00058 <span class="comment">// pulseT1ASetFreq() and pulseT1BSetFreq()</span>00059 <span class="comment">// sets the frequency in hertz for each channel of square-wave pulse output</span>00060 <span class="comment">// Note1: the freqency <freqHz> must always be greater than zero</span>00061 <span class="comment">// Note2: both channels share the same frequency range which is governed</span>00062 <span class="comment">// by the timer1 prescaler setting. A prescaler setting of DIV/8 allows</span>00063 <span class="comment">// frequencies of a few hertz through a few kilohertz.</span>00064 <span class="comment">//</span>00065 <span class="comment">// Lower frequency bound = overflow rate of timer1 at current prescaling</span>00066 <span class="comment">// Upper frequency bound = the tics rate of timer1 at current prescaling,</span>00067 <span class="comment">// or approx. the (clock rate of the processor)/50,</span>00068 <span class="comment">// whichever is smaller</span>00069 <span class="keywordtype">void</span> pulseT1ASetFreq(u16 freqHz);00070 <span class="keywordtype">void</span> pulseT1BSetFreq(u16 freqHz);00071 00072 <span class="comment">// pulseT1ARun() and pulseT1BRun();</span>00073 <span class="comment">// Sets the number of square-wave pulses to be output on the given channel.</span>00074 <span class="comment">// For continuous (unlimited) pulse output, use nPulses = 0. Pulses begin</span>00075 <span class="comment">// coming out immediately.</span>00076 <span class="comment">// Note: <nPulses> must be between 0 and 32767</span>00077 <span class="keywordtype">void</span> pulseT1ARun(u16 nPulses);00078 <span class="keywordtype">void</span> pulseT1BRun(u16 nPulses);00079 00080 <span class="comment">// pulseT1AStop() and pulseT1BStop();</span>00081 <span class="comment">// Stop pulse output at the next cycle (regardless of the number of</span>00082 <span class="comment">// remaining pulses).</span>00083 <span class="keywordtype">void</span> pulseT1AStop(<span class="keywordtype">void</span>);00084 <span class="keywordtype">void</span> pulseT1BStop(<span class="keywordtype">void</span>);00085 00086 <span class="comment">// pulseT1ARemaining() and pulseT1BRemaining()</span>00087 <span class="comment">// Returns the number of pulses remaining to be output for each channel.</span>00088 <span class="comment">// This function is useful for figuring out if the pulses are done.</span>00089 u16 pulseT1ARemaining(<span class="keywordtype">void</span>);00090 u16 pulseT1BRemaining(<span class="keywordtype">void</span>);00091 00092 <span class="comment">// pulseT1AService() and pulseT1BService()</span>00093 <span class="comment">// Interrupt service routines for pulse output (do not call these functions directly)</span>00094 <span class="keywordtype">void</span> pulseT1AService(<span class="keywordtype">void</span>);00095 <span class="keywordtype">void</span> pulseT1BService(<span class="keywordtype">void</span>);00096 00097 00098 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Oct 15 03:50:22 2004 for Procyon AVRlib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.6 </small></address></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -