📄 servoconf_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: conf/servoconf.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 Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</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> | <a class="qindex" href="pages.html">Related Pages</a></div><div class="nav"><a class="el" href="dir_000000.html">conf</a></div><h1>servoconf.h</h1><a href="servoconf_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file servoconf.h \brief Interrupt-driven RC Servo configuration. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'servoconf.h'</span>00005 <span class="comment">// Title : Interrupt-driven RC Servo function library</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002</span>00007 <span class="comment">// Created : 07/31/2002</span>00008 <span class="comment">// Revised : 09/30/2002</span>00009 <span class="comment">// Version : 1.0</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">// NOTE: you need the latest version (3.2+) of the AVR-GCC compiler to use this</span>00014 <span class="comment">// function library. Download it from http://www.avrfreaks.net/AVRGCC</span>00015 <span class="comment">//</span>00016 <span class="comment">// Description : This code allows you to drive up to 8 RC servos from any</span>00017 <span class="comment">// combination of ports and pins on the AVR processor. Using interrupts,</span>00018 <span class="comment">// this code continuously sends control signals to the servo to maintain</span>00019 <span class="comment">// position even while your code is doing other work.</span>00020 <span class="comment">//</span>00021 <span class="comment">// The servoInit and servoOff effectively turn on and turn off servo</span>00022 <span class="comment">// control. When you run ServoInit, it automatically assigns each</span>00023 <span class="comment">// "channel" of servo control to be output on the SERVO_DEFAULT_PORT.</span>00024 <span class="comment">// One "channel" of servo control can control one servo and must be</span>00025 <span class="comment">// assigned single I/O pin for output.</span>00026 <span class="comment">//</span>00027 <span class="comment">// If you're using all eight channels (SERVO_NUM_CHANNELS = 8), then</span>00028 <span class="comment">// then by default the code will use SERVO_DEFAULT_PORT pins 0-7.</span>00029 <span class="comment">// If you're only using four channels, then pins 0-3 will be used by</span>00030 <span class="comment">// default.</span>00031 <span class="comment">//</span>00032 <span class="comment">// The command servoSetChannelIO(channel, port, pin) allows you to</span>00033 <span class="comment">// reassign the output of any channel to any port and I/O pin you</span>00034 <span class="comment">// choose. For exampe, if you have an RC servo connected to PORTC, pin 6,</span>00035 <span class="comment">// and you wish to use channel 2 to control it, use:</span>00036 <span class="comment">//</span>00037 <span class="comment">// servoSerChannelIO( 2, _SFR_IO_ADDR(PORTC), 6)</span>00038 <span class="comment">//</span>00039 <span class="comment">// (NOTE: you must include the "_SRF_IO_ADDR()" part around your port)</span>00040 <span class="comment">//</span>00041 <span class="comment">// The servoSetPostion and servoGetPosition commands allow you to command</span>00042 <span class="comment">// a given servo to your desired position. The position you request must</span>00043 <span class="comment">// lie between the SERVO_MIN and SERVO_MAX limit you defined.</span>00044 <span class="comment">//</span>00045 <span class="comment">// This code is distributed under the GNU Public License</span>00046 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00047 <span class="comment">//</span>00048 <span class="comment">//*****************************************************************************</span>00049 00050 <span class="preprocessor">#ifndef SERVOCONF_H</span>00051 <span class="preprocessor"></span><span class="preprocessor">#define SERVOCONF_H</span>00052 <span class="preprocessor"></span>00053 <span class="comment">// set number of servo channels (1 to 8)</span>00054 <span class="comment">// This is the number of servos you would like to drive</span>00055 <span class="comment">// Each "Channel" can control one servo and by default will</span>00056 <span class="comment">// map directly to the port pin of the same number on the</span>00057 <span class="comment">// SERVO_DEFAULT_PORT. You can change this default port/pin</span>00058 <span class="comment">// assignment for a given channel to any port/pin you like.</span>00059 <span class="comment">// See the "servoSetChannelIO" function.</span>00060 <span class="preprocessor">#define SERVO_NUM_CHANNELS 4</span>00061 <span class="preprocessor"></span><span class="comment">// set default SERVO output port</span>00062 <span class="comment">// This is the AVR port which you have connected to your servos </span>00063 <span class="comment">// See top of file for how servo "channels" map to port pins</span>00064 <span class="preprocessor">#define SERVO_DEFAULT_PORT PORTB</span>00065 <span class="preprocessor"></span><span class="comment">// set servo characteristics (min and max raw position)</span>00066 <span class="comment">// You must find these by testing using your brand/type of servos.</span>00067 <span class="comment">// The min/max settings will change proportional to F_CPU, the CPU</span>00068 <span class="comment">// clock frequency.</span>00069 <span class="comment">// The numbers below good for parallax servos at an F_CPU of ~8MHz.</span>00070 <span class="comment">//#define SERVO_MAX 71</span>00071 <span class="comment">//#define SERVO_MIN 17</span>00072 <span class="comment">// The numbers below good for parallax servos at an F_CPU of ~14.745MHz.</span>00073 <span class="preprocessor">#define SERVO_MAX 138</span>00074 <span class="preprocessor"></span><span class="preprocessor">#define SERVO_MIN 34</span>00075 <span class="preprocessor"></span>00076 <span class="comment">// set servo scaled range</span>00077 <span class="comment">// This sets the scaled position range of the servo. Allowed scaled</span>00078 <span class="comment">// positions are 0 -> SERVO_POSITION_MAX, and correspond to raw</span>00079 <span class="comment">// positions of SERVO_MIN -> SERVO_MAX.</span>00080 <span class="preprocessor">#define SERVO_POSITION_MAX 255</span>00081 <span class="preprocessor"></span>00082 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by <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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -