2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: brushless_config.h,v 1.2.2.2 2007-05-12 16:42:38 zer0 Exp $
22 #ifndef BRUSHLESS_TYPE
23 #define BRUSHLESS_TYPE BRUSHLESS_DIGITAL
26 /** a setting of 1 gives 6 steps per electrical turn
27 the number of electrical poles per mechanical revolution depends on your motor.
28 Please consider that a value different from 1 rises the processor load ! so try to use 1
30 #define BRUSHLESS_POSITION_PRECISION 1
33 typedef int16_t brushless_speed;
34 typedef int32_t brushless_position;
36 typedef int16_t brushless_torque; // max value is that of the PWM
39 /** motor connection definition */
41 /** inversion of sensors*/
42 #define BRUSHLESS_SENSORS_INVERT
44 /** sensor pull ups. This is recommended for safety */
45 //#define BRUSHLESS_SENSORS_PULL_UP_RESISTORS
47 /** sensors port definitions */
48 #define BRUSHLESS_SENSOR_1_PORT PORTA
49 #define BRUSHLESS_SENSOR_1_BIT 0
50 #define BRUSHLESS_SENSOR_2_PORT PORTA
51 #define BRUSHLESS_SENSOR_2_BIT 1
52 #define BRUSHLESS_SENSOR_3_PORT PORTA
53 #define BRUSHLESS_SENSOR_3_BIT 2
56 Please activate the PWM synch in pwm.h if you use PWMs from separate timers
58 #define BRUSHLESS_PWM_SET_1(value) pwm_set_1A(value)
59 #define BRUSHLESS_PWM_SET_2(value) pwm_set_1B(value)
60 #define BRUSHLESS_PWM_SET_3(value) pwm_set_2(value)
62 /** this selects the timer overflow int to use
63 please enter the timer number of one of the 3 PWMs
64 for example,if one of your pwm is the 2A, enter "2" here
66 #define BRUSHLESS_TIMER 1
70 /** total inversion of the motor behaviour, other configuration remains the same */
71 #define BRUSHLESS_INVERT
73 /** following parameters calculateas such :
75 fsample = fpwm / PWM_TO_SAMPLE_DIVISOR
77 fevent = fsample / SAMPLE_TO_EVENT_DIVISOR
79 it is recommended to have fsample at approx 10 kHz max, less if you plan a slow motor
80 SAMPLE_TO_EVENT_DIVISOR should be at least 100, or more, so that the event is slow enough for your need
82 these parameters should be carefully chosen to not overload the processor
87 #define BRUSHLESS_PWM_TO_SAMPLE_DIVISOR 3
88 /** max 65535, min recommended 100 */
89 #define BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR 10000 // 1,041s with a 8 MHz quartz
92 /** max speed, is in general to BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR
93 but can be adapted to your needs, if you need to go further down with the speed */
94 #define BRUSHLESS_MAX_SPEED BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR
99 #endif // BRUSHLESS_TYPE