BLDC control on ATAVRMC303 with ATxMega128A1
config.h
Go to the documentation of this file.
1 
11 //_____ I N C L U D E S ___________________________________________________
12 
13 
14 
15 #ifdef __GNUC__
16  #include "gcc_compiler.h"
17  #include <avr/io.h>
18  #include <avr/pgmspace.h>
19  #include <avr/interrupt.h>
20 
21  #define putchar(c) uart_putchar(c)
22  #define getchar(c) uart_getchar(c)
23 
24  #define Uchar U8
25  #define Uint32 U32
26  #define Enable_interrupt() __enable_interrupt
27  #define Disable_interrupt() __disable_interrupt
28  #define code PROGMEM
29 // #define code
30  #define MSB(u16) (((U8* )&u16)[1])
31  #define LSB(u16) (((U8* )&u16)[0])
32  #define HIGH(v) MSB(v)
33  #define LOW(v) LSB(v)
34 
35  #define ADASCR 4
36  #define AMP1ND 0
37  #define AMP1PD 1
38  #define ACMP1D 2
39  #define PLLOCK 0
40 
41 /* AMP0CSR */
42 #define AMP0EN 7
43 #define AMP0IS 6
44 #define AMP0G1 5
45 #define AMP0G0 4
46 #define AMP0TS2 2
47 #define AMP0TS1 1
48 #define AMP0TS0 0
49 
50 /* AMP1CSR */
51 #define AMP1EN 7
52 #define AMP1IS 6
53 #define AMP1G1 5
54 #define AMP1G0 4
55 #define AMP1TS2 2
56 #define AMP1TS1 1
57 #define AMP1TS0 0
58 
59 
60 #else
61  #include "compiler.h"
62 // #include "mcu.h"
63  #include "inavr.h"
64  #include "ioavr.h"
65 #endif
66 
67 
68 #include "config_motor.h"
69 
70 
71 #ifndef _CONFIG_H_
72 #define _CONFIG_H_
73 #endif
74 
75 
76 #define BOARD_ID 1 /* 0:unknown, 1 : MC100, 2 : MC200 */
77 #define SOFT_ID 1 /* 0:unknown, 1:bldc sensor, 2:bldc sinus, 3:bldc sensorless */
78 #define REV_ID 1
79 
80 /*-------------- UART LIB CONFIGURATION ---------------*/
81 //#define DB101
82 #define BAUDRATE 38400
83 #define FOSC 16000
84 
85 #define uart_putchar putchar
86 
90 #define USE_ADC
91 
92 #define ADC_RIGHT_ADJUST_RESULT 0
93 #define ADC_HIGH_SPEED_MODE 1 //
94 #define ADC_INTERNAL_VREF 1
95 #define ADC_IT 1
96 #define ADC_PRESCALER 4
97 
98 #define USE_DAC
102 
103 #define DAC_INPUT_RIGHT_ADJUST 0
104 #define DAC_INTERNAL_VREF 1
105 #define DAC_OUTPUT_DRIVER 1
106 
107 
111 #define USE_COMP0
112 #define COMPARATOR0_IT 1
113 #define COMPARATOR0_IT_EVENT 0
114 #define COMPARATOR0_NEGATIVE_INPUT 4
115 
116 #define USE_COMP1
117 #define COMPARATOR1_IT 1
118 #define COMPARATOR1_IT_EVENT 0
119 #define COMPARATOR1_NEGATIVE_INPUT 4
120 
121 #define USE_COMP2
122 #define COMPARATOR2_IT 1
123 #define COMPARATOR2_IT_EVENT 0
124 #define COMPARATOR2_NEGATIVE_INPUT 4
125