00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "lib_mcu/compiler.h"
00016 #include "lib_mcu/mcu.h"
00017 #include "inavr.h"
00018
00019 #ifndef _CONFIG_H_
00020 #define _CONFIG_H_
00021 #endif
00022
00023 #define BOARD_ID 1
00024 #define SOFT_ID 2
00025 #define REV_ID 1
00026
00027
00028
00029 #define BAUDRATE 38400
00030 #define FOSC 16000
00031
00032 #define uart_putchar putchar
00033
00034
00035 #define Set_PC7() PORTC |= (1<<PC7)
00036 #define Clear_PC7() PORTC &= ~(1<<PC7)
00037 #define Toggle_PC7() PINC |= (1<<PINC7)
00038
00039 #define Set_PC1() PORTC |= (1<<PC1)
00040 #define Clear_PC1() PORTC &= ~(1<<PC1)
00041 #define Toggle_PC1() PINC |= (1<<PINC1)
00042
00043 #define Set_PE1() PORTE |= (1<<PE1)
00044 #define Clear_PE1() PORTE &= ~(1<<PE1)
00045 #define Toggle_PE1() PINE |= (1<<PINE1)
00046
00047 #define Set_PE2() PORTE |= (1<<PE2)
00048 #define Clear_PE2() PORTE &= ~(1<<PE2)
00049 #define Toggle_PE2() PINE |= (1<<PINE2)
00050
00051 #define USE_COMP0
00052 #define COMPARATOR0_IT 1
00053 #define COMPARATOR0_IT_EVENT 0
00054 #define COMPARATOR0_NEGATIVE_INPUT 2
00055
00056
00057 #define USE_COMP1
00058 #define COMPARATOR1_IT 1
00059 #define COMPARATOR1_IT_EVENT 0
00060 #define COMPARATOR1_NEGATIVE_INPUT 2
00061
00062
00063 #define USE_COMP2
00064 #define COMPARATOR2_IT 1
00065 #define COMPARATOR2_IT_EVENT 0
00066 #define COMPARATOR2_NEGATIVE_INPUT 2
00067
00068
00069 #define MAX_PWM 1333
00070
00071 #define DEAD_TIME 32
00072 #define MAX_AMPLITUDE ((MAX_PWM / 2) - DEAD_TIME)
00073
00074 #define AMPLITUDE_IN_OPEN_LOOP 600
00075 #define REGULATION_MODE 1
00076
00077 #define ADVANCE 0
00078
00079 #define MAX_THETA 80 // equals one sixth of the circle
00080
00081 #define K_SPEED 39500
00088
00089
00093 enum {RUN = TRUE, STOP = FALSE};
00094
00098 enum {CCW = TRUE, CW = FALSE};
00099
00100