Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

servoconf.h

Go to the documentation of this file.
00001 /*! \file servoconf.h \brief Interrupt-driven RC Servo configuration. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'servoconf.h'
00005 // Title        : Interrupt-driven RC Servo function library
00006 // Author       : Pascal Stang - Copyright (C) 2002
00007 // Created      : 07/31/2002
00008 // Revised      : 09/30/2002
00009 // Version      : 1.0
00010 // Target MCU   : Atmel AVR Series
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: you need the latest version (3.2+) of the AVR-GCC compiler to use this
00014 //  function library.  Download it from http://www.avrfreaks.net/AVRGCC
00015 //
00016 // Description : This code allows you to drive up to 8 RC servos from any
00017 //      combination of ports and pins on the AVR processor. Using interrupts,
00018 //      this code continuously sends control signals to the servo to maintain
00019 //      position even while your code is doing other work.
00020 //
00021 //      The servoInit and servoOff effectively turn on and turn off servo
00022 //      control.  When you run ServoInit, it automatically assigns each
00023 //      "channel" of servo control to be output on the SERVO_DEFAULT_PORT.
00024 //      One "channel" of servo control can control one servo and must be
00025 //      assigned single I/O pin for output.
00026 //
00027 //      If you're using all eight channels (SERVO_NUM_CHANNELS = 8), then
00028 //      then by default the code will use SERVO_DEFAULT_PORT pins 0-7.
00029 //      If you're only using four channels, then pins 0-3 will be used by
00030 //      default.
00031 //
00032 //      The command servoSetChannelIO(channel, port, pin) allows you to
00033 //      reassign the output of any channel to any port and I/O pin you
00034 //      choose.  For exampe, if you have an RC servo connected to PORTC, pin 6,
00035 //      and you wish to use channel 2 to control it, use:
00036 //
00037 //      servoSerChannelIO( 2, _SFR_IO_ADDR(PORTC), 6)
00038 //
00039 //      (NOTE: you must include the "_SRF_IO_ADDR()" part around your port)
00040 //
00041 //      The servoSetPostion and servoGetPosition commands allow you to command
00042 //      a given servo to your desired position.  The position you request must
00043 //      lie between the SERVO_MIN and SERVO_MAX limit you defined.
00044 //
00045 // This code is distributed under the GNU Public License
00046 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00047 //
00048 //*****************************************************************************
00049 
00050 #ifndef SERVOCONF_H
00051 #define SERVOCONF_H
00052 
00053 // set number of servo channels (1 to 8)
00054 //      This is the number of servos you would like to drive
00055 //      Each "Channel" can control one servo and by default will
00056 //      map directly to the port pin of the same number on the
00057 //      SERVO_DEFAULT_PORT.  You can change this default port/pin
00058 //      assignment for a given channel to any port/pin you like.
00059 //      See the "servoSetChannelIO" function.
00060 #define SERVO_NUM_CHANNELS      4
00061 // set default SERVO output port
00062 //      This is the AVR port which you have connected to your servos 
00063 //      See top of file for how servo "channels" map to port pins
00064 #define SERVO_DEFAULT_PORT      PORTB
00065 // set servo characteristics (min and max raw position)
00066 //      You must find these by testing using your brand/type of servos.
00067 //      The min/max settings will change proportional to F_CPU, the CPU
00068 //      clock frequency.
00069 // The numbers below good for parallax servos at an F_CPU of ~8MHz.
00070 //#define SERVO_MAX             71
00071 //#define SERVO_MIN             17
00072 // The numbers below good for parallax servos at an F_CPU of ~14.745MHz.
00073 #define SERVO_MAX               138
00074 #define SERVO_MIN               34
00075 
00076 // set servo scaled range
00077 //      This sets the scaled position range of the servo.  Allowed scaled
00078 //      positions are 0 -> SERVO_POSITION_MAX, and correspond to raw
00079 //      positions of SERVO_MIN -> SERVO_MAX.
00080 #define SERVO_POSITION_MAX      255
00081 
00082 #endif

Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by  doxygen 1.4.2