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_3phase_digital_hall_config.h,v 1.2.2.2 2007-05-12 16:42:39 zer0 Exp $
22 #ifndef BRUSHLESS_TYPE
23 #define BRUSHLESS_TYPE BRUSHLESS_DIGITAL_DOUBLE
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 0 connection definition */
41 /** inversion of sensors*/
42 //#define BRUSHLESS_0_SENSORS_INVERT
44 /** sensor pull ups. This is recommended for safety */
45 //#define BRUSHLESS_0_SENSORS_PULL_UP_RESISTORS
47 /** sensors port definitions */
48 #define BRUSHLESS_0_SENSOR_1_PORT PORTA
49 #define BRUSHLESS_0_SENSOR_1_BIT 4
50 #define BRUSHLESS_0_SENSOR_2_PORT PORTA
51 #define BRUSHLESS_0_SENSOR_2_BIT 3
52 #define BRUSHLESS_0_SENSOR_3_PORT PORTA
53 #define BRUSHLESS_0_SENSOR_3_BIT 5
56 Please activate the PWM synch in pwm.h if you use PWMs from separate timers
58 #define BRUSHLESS_0_PWM_SET_1(value) pwm_set_1A(value)
59 #define BRUSHLESS_0_PWM_SET_2(value) pwm_set_1B(value)
60 #define BRUSHLESS_0_PWM_SET_3(value) pwm_set_1C(value)
64 /** total inversion of the motor behaviour, other configuration remains the same */
65 //#define BRUSHLESS_0_INVERT
70 /** this selects the timer overflow int to use
71 please enter the timer number of one of the 6 PWMs
72 for example,if one of your pwm is the 2A, enter "2" here
74 #define BRUSHLESS_TIMER 1
76 /** following parameters calculateas such :
78 fsample = fpwm / PWM_TO_SAMPLE_DIVISOR
80 fevent = fsample / SAMPLE_TO_EVENT_DIVISOR
82 it is recommended to have fsample at approx 10 kHz max, less if you plan a slow motor
83 SAMPLE_TO_EVENT_DIVISOR should be at least 100, or more, so that the event is slow enough for your need
85 these parameters should be carefully chosen to not overload the processor
90 #define BRUSHLESS_PWM_TO_SAMPLE_DIVISOR 4 // PWM9 bits, quartz 16 MHz >> 7.8 kHz
91 /** max 65535, min recommended 100 */
92 #define BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR 7812 // environ 1s
95 /** max speed, is in general to BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR
96 but can be adapted to your needs, if you need to go further down with the speed */
97 #define BRUSHLESS_MAX_SPEED BRUSHLESS_SAMPLE_TO_EVENT_DIVISOR
101 //#define LOADTEST // define this to test the maximum processor load !
103 //#define ASMHEADER // optimized PWM division : particularly useful with 8 bit timers ! Using this can display one warning
106 #endif // BRUSHLESS_TYPE