sensor_three_phase_BLDC.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00024 
00025 
00026 #define UL  PD6
00027 #define VL  PD5
00028 #define WL  PD3
00029 #define UH  PD7
00030 #define VH  PD4
00031 #define WH  PD2
00032 #define MC_MASK   ((1<<UL)|(1<<VL)|(1<<WL)|(1<<UH)|(1<<VH)|(1<<WH))
00033 
00034 
00035 
00036 
00038 
00039 #define PORT_MC PORTD
00040 #define DDR_MC  DDRD
00041 #define PIN_MC  PIND
00042 
00043 
00044 
00045 
00047 
00048 #define HALL1 PB1
00049 #define HALL2 PB2
00050 #define HALL3 PB3
00051 #define HALL_MASK  ((1<<HALL1)|(1<<HALL2)|(1<<HALL3))
00052 
00053 
00054 
00055 
00057 
00058 #define PORT_HALL PORTB
00059 #define DDR_HALL  DDRB
00060 #define PIN_HALL  PINB
00061 
00062 
00063 
00064 
00065 #define PATTERN_DRV_OFFSET  0 
00066 #define PATTERN_COM0_OFFSET 6 
00067 #define PATTERN_COM2_OFFSET 12 
00068 
00069 
00070 
00077 #define PDP1_CCW  ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH))
00078 #define PDP2_CCW  ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH))
00079 #define PDP3_CCW  ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH))
00080 #define PDP4_CCW  ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH))
00081 #define PDP5_CCW  ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH))
00082 #define PDP6_CCW  ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH))
00083 
00084 
00085 
00086 
00093 #define PDP1_CW  ((0<<UL)|(0<<VL)|(1<<WL)|(0<<UH)|(1<<VH)|(0<<WH))
00094 #define PDP2_CW  ((0<<UL)|(0<<VL)|(1<<WL)|(1<<UH)|(0<<VH)|(0<<WH))
00095 #define PDP3_CW  ((0<<UL)|(1<<VL)|(0<<WL)|(1<<UH)|(0<<VH)|(0<<WH))
00096 #define PDP4_CW  ((0<<UL)|(1<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH))
00097 #define PDP5_CW  ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(0<<VH)|(1<<WH))
00098 #define PDP6_CW  ((1<<UL)|(0<<VL)|(0<<WL)|(0<<UH)|(1<<VH)|(0<<WH))
00099 
00100 
00101 #define OVERCURRENT_PIN PC1   
00102 
00104 
00105 #define UL_ON   ((1<<COM0A1)|(0<<COM0A0))
00106 #define UL_OFF  ((0<<COM0A1)|(0<<COM0A0))
00107 #define VL_ON   ((1<<COM0B1)|(0<<COM0B0))
00108 #define VL_OFF  ((0<<COM0B1)|(0<<COM0B0))
00109 #define WL_ON   ((1<<COM2B1)|(0<<COM2B0))
00110 #define WL_OFF  ((0<<COM2B1)|(0<<COM2B0))
00111 
00112 #define COM0P1_CCW  ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00113 #define COM2P1_CCW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00114 #define COM0P2_CCW  ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00115 #define COM2P2_CCW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00116 #define COM0P3_CCW  ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00))
00117 #define COM2P3_CCW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00118 #define COM0P4_CCW  ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00))
00119 #define COM2P4_CCW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00120 #define COM0P5_CCW  ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00121 #define COM2P5_CCW  ((WL_ON)|(1<<WGM21)|(1<<WGM20))
00122 #define COM0P6_CCW  ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00123 #define COM2P6_CCW  ((WL_ON)|(1<<WGM21)|(1<<WGM20))
00124 
00125 #define COM0P1_CW  ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00126 #define COM2P1_CW  ((WL_ON)|(1<<WGM21)|(1<<WGM20))
00127 #define COM0P2_CW  ((UL_OFF)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00128 #define COM2P2_CW  ((WL_ON)|(1<<WGM21)|(1<<WGM20))
00129 #define COM0P3_CW  ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00))
00130 #define COM2P3_CW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00131 #define COM0P4_CW  ((UL_OFF)|(VL_ON)|(1<<WGM01)|(1<<WGM00))
00132 #define COM2P4_CW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00133 #define COM0P5_CW  ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00134 #define COM2P5_CW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00135 #define COM0P6_CW  ((UL_ON)|(VL_OFF)|(1<<WGM01)|(1<<WGM00))
00136 #define COM2P6_CW  ((WL_OFF)|(1<<WGM21)|(1<<WGM20))
00137 
00138 #define HP1 ((1<<HALL1)|(0<<HALL2)|(1<<HALL3))
00139 #define HP2 ((1<<HALL1)|(0<<HALL2)|(0<<HALL3))
00140 #define HP3 ((1<<HALL1)|(1<<HALL2)|(0<<HALL3))
00141 #define HP4 ((0<<HALL1)|(1<<HALL2)|(0<<HALL3))
00142 #define HP5 ((0<<HALL1)|(1<<HALL2)|(1<<HALL3))
00143 #define HP6 ((0<<HALL1)|(0<<HALL2)|(1<<HALL3))
00144 
00145 
00146 
00147 // Direction control
00148 #define CLOCKWISE         1 
00149 #define COUNTERCLOCKWISE  0 
00150 
00151 
00152 
00154 
00155 #define ADC_MUX_SPEED_REF   ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR))
00156 #define ADC_MUX_SHUNT_H     ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2))
00157 #define ADC_MUX_SHUNT_L     ((0 << REFS1) | (0 << REFS0) | (1 << ADLAR) | (1 << MUX2) | (1 << MUX0))
00158 
00159 
00160 
00161 
00162 // Current limiting
00163 #define MAX_CURRENT                     1.0f   
00164 #define CURRENT_SHUNT_RESISTANCE        0.22f  
00165 #define ADC_REF_VOLTAGE                 5.0f   
00166 
00167 #define VOLTS_PER_ADC_STEP              (ADC_REF_VOLTAGE / 256)  
00168 #define MAX_SHUNT_VOLTAGE               (MAX_CURRENT * CURRENT_SHUNT_RESISTANCE)  
00169 #define MAX_CURRENT_ADC                 (signed int)(MAX_SHUNT_VOLTAGE / VOLTS_PER_ADC_STEP) 

Generated on Tue Sep 18 08:53:11 2007 for AVR443 Sensor-based control of three phase Brushless DC Motor by  doxygen 1.4.7