| 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: conf/servoconf.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 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> |
||
| 8 | <div class="nav"> |
||
| 9 | <a class="el" href="dir_000000.html">conf</a></div> |
||
| 10 | <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> |
||
| 11 | 00002 <span class="comment">//*****************************************************************************</span> |
||
| 12 | 00003 <span class="comment">//</span> |
||
| 13 | 00004 <span class="comment">// File Name : 'servoconf.h'</span> |
||
| 14 | 00005 <span class="comment">// Title : Interrupt-driven RC Servo function library</span> |
||
| 15 | 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002</span> |
||
| 16 | 00007 <span class="comment">// Created : 07/31/2002</span> |
||
| 17 | 00008 <span class="comment">// Revised : 09/30/2002</span> |
||
| 18 | 00009 <span class="comment">// Version : 1.0</span> |
||
| 19 | 00010 <span class="comment">// Target MCU : Atmel AVR Series</span> |
||
| 20 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
| 21 | 00012 <span class="comment">//</span> |
||
| 22 | 00013 <span class="comment">// NOTE: you need the latest version (3.2+) of the AVR-GCC compiler to use this</span> |
||
| 23 | 00014 <span class="comment">// function library. Download it from http://www.avrfreaks.net/AVRGCC</span> |
||
| 24 | 00015 <span class="comment">//</span> |
||
| 25 | 00016 <span class="comment">// Description : This code allows you to drive up to 8 RC servos from any</span> |
||
| 26 | 00017 <span class="comment">// combination of ports and pins on the AVR processor. Using interrupts,</span> |
||
| 27 | 00018 <span class="comment">// this code continuously sends control signals to the servo to maintain</span> |
||
| 28 | 00019 <span class="comment">// position even while your code is doing other work.</span> |
||
| 29 | 00020 <span class="comment">//</span> |
||
| 30 | 00021 <span class="comment">// The servoInit and servoOff effectively turn on and turn off servo</span> |
||
| 31 | 00022 <span class="comment">// control. When you run ServoInit, it automatically assigns each</span> |
||
| 32 | 00023 <span class="comment">// "channel" of servo control to be output on the SERVO_DEFAULT_PORT.</span> |
||
| 33 | 00024 <span class="comment">// One "channel" of servo control can control one servo and must be</span> |
||
| 34 | 00025 <span class="comment">// assigned single I/O pin for output.</span> |
||
| 35 | 00026 <span class="comment">//</span> |
||
| 36 | 00027 <span class="comment">// If you're using all eight channels (SERVO_NUM_CHANNELS = 8), then</span> |
||
| 37 | 00028 <span class="comment">// then by default the code will use SERVO_DEFAULT_PORT pins 0-7.</span> |
||
| 38 | 00029 <span class="comment">// If you're only using four channels, then pins 0-3 will be used by</span> |
||
| 39 | 00030 <span class="comment">// default.</span> |
||
| 40 | 00031 <span class="comment">//</span> |
||
| 41 | 00032 <span class="comment">// The command servoSetChannelIO(channel, port, pin) allows you to</span> |
||
| 42 | 00033 <span class="comment">// reassign the output of any channel to any port and I/O pin you</span> |
||
| 43 | 00034 <span class="comment">// choose. For exampe, if you have an RC servo connected to PORTC, pin 6,</span> |
||
| 44 | 00035 <span class="comment">// and you wish to use channel 2 to control it, use:</span> |
||
| 45 | 00036 <span class="comment">//</span> |
||
| 46 | 00037 <span class="comment">// servoSerChannelIO( 2, _SFR_IO_ADDR(PORTC), 6)</span> |
||
| 47 | 00038 <span class="comment">//</span> |
||
| 48 | 00039 <span class="comment">// (NOTE: you must include the "_SRF_IO_ADDR()" part around your port)</span> |
||
| 49 | 00040 <span class="comment">//</span> |
||
| 50 | 00041 <span class="comment">// The servoSetPostion and servoGetPosition commands allow you to command</span> |
||
| 51 | 00042 <span class="comment">// a given servo to your desired position. The position you request must</span> |
||
| 52 | 00043 <span class="comment">// lie between the SERVO_MIN and SERVO_MAX limit you defined.</span> |
||
| 53 | 00044 <span class="comment">//</span> |
||
| 54 | 00045 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
| 55 | 00046 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
| 56 | 00047 <span class="comment">//</span> |
||
| 57 | 00048 <span class="comment">//*****************************************************************************</span> |
||
| 58 | 00049 |
||
| 59 | 00050 <span class="preprocessor">#ifndef SERVOCONF_H</span> |
||
| 60 | 00051 <span class="preprocessor"></span><span class="preprocessor">#define SERVOCONF_H</span> |
||
| 61 | 00052 <span class="preprocessor"></span> |
||
| 62 | 00053 <span class="comment">// set number of servo channels (1 to 8)</span> |
||
| 63 | 00054 <span class="comment">// This is the number of servos you would like to drive</span> |
||
| 64 | 00055 <span class="comment">// Each "Channel" can control one servo and by default will</span> |
||
| 65 | 00056 <span class="comment">// map directly to the port pin of the same number on the</span> |
||
| 66 | 00057 <span class="comment">// SERVO_DEFAULT_PORT. You can change this default port/pin</span> |
||
| 67 | 00058 <span class="comment">// assignment for a given channel to any port/pin you like.</span> |
||
| 68 | 00059 <span class="comment">// See the "servoSetChannelIO" function.</span> |
||
| 69 | 00060 <span class="preprocessor">#define SERVO_NUM_CHANNELS 4</span> |
||
| 70 | 00061 <span class="preprocessor"></span><span class="comment">// set default SERVO output port</span> |
||
| 71 | 00062 <span class="comment">// This is the AVR port which you have connected to your servos </span> |
||
| 72 | 00063 <span class="comment">// See top of file for how servo "channels" map to port pins</span> |
||
| 73 | 00064 <span class="preprocessor">#define SERVO_DEFAULT_PORT PORTB</span> |
||
| 74 | 00065 <span class="preprocessor"></span><span class="comment">// set servo characteristics (min and max raw position)</span> |
||
| 75 | 00066 <span class="comment">// You must find these by testing using your brand/type of servos.</span> |
||
| 76 | 00067 <span class="comment">// The min/max settings will change proportional to F_CPU, the CPU</span> |
||
| 77 | 00068 <span class="comment">// clock frequency.</span> |
||
| 78 | 00069 <span class="comment">// The numbers below good for parallax servos at an F_CPU of ~8MHz.</span> |
||
| 79 | 00070 <span class="comment">//#define SERVO_MAX 71</span> |
||
| 80 | 00071 <span class="comment">//#define SERVO_MIN 17</span> |
||
| 81 | 00072 <span class="comment">// The numbers below good for parallax servos at an F_CPU of ~14.745MHz.</span> |
||
| 82 | 00073 <span class="preprocessor">#define SERVO_MAX 138</span> |
||
| 83 | 00074 <span class="preprocessor"></span><span class="preprocessor">#define SERVO_MIN 34</span> |
||
| 84 | 00075 <span class="preprocessor"></span> |
||
| 85 | 00076 <span class="comment">// set servo scaled range</span> |
||
| 86 | 00077 <span class="comment">// This sets the scaled position range of the servo. Allowed scaled</span> |
||
| 87 | 00078 <span class="comment">// positions are 0 -> SERVO_POSITION_MAX, and correspond to raw</span> |
||
| 88 | 00079 <span class="comment">// positions of SERVO_MIN -> SERVO_MAX.</span> |
||
| 89 | 00080 <span class="preprocessor">#define SERVO_POSITION_MAX 255</span> |
||
| 90 | 00081 <span class="preprocessor"></span> |
||
| 91 | 00082 <span class="preprocessor">#endif</span> |
||
| 92 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by |
||
| 93 | <a href="http://www.doxygen.org/index.html"> |
||
| 94 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
| 95 | </body> |
||
| 96 | </html> |
Powered by WebSVN v2.8.3