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