00001
00009 void update_motor_3(uint8 u8_motor, uint8 u8_direction, uint16 u16_duration);
00010 void initialize_motor_3(void);
00011 ESOS_USER_INTERRUPT(ESOS_IRQ_PIC24_T3);
00012
00023
00024 #define MOTOR_3_1 0x31
00025 #define MOTOR_3_2 0x32
00026 #define MOTOR_3_3 0x33
00027 #define MOTOR_3_4 0x34
00028 #define MOTOR_3_5 0x35
00029 #define MOTOR_3_6 0x36
00030 #define MOTOR_3_7 0x37
00031 #define MOTOR_3_8 0x38
00033
00034
00042
00043 #define MOTOR_COAST 0b00000100
00044 #define MOTOR_FORWARD 0b00000001
00045 #define MOTOR_REVERSE 0b00000010
00046 #define MOTOR_BRAKEL 0b00000000
00047 #define MOTOR_BRAKEH 0b00000011
00049
00050
00055 #define MAX_NUM_MOTORS_USED_3 8
00056
00062 #define MOTOR_TIMER_USED_3
00063
00064
00065 #ifdef ESOS_USE_IRQS
00066 #if (MOTOR_IRQ_LEVEL_3 == 1)
00067 #define MOTOR_IRQ_3 ESOS_USER_IRQ_LEVEL1
00068 #elif (MOTOR_IRQ_LEVEL_3 == 2)
00069 #define MOTOR_IRQ_3 ESOS_USER_IRQ_LEVEL2
00070 #elif (MOTOR_IRQ_LEVEL_3 == 3)
00071 #define MOTOR_IRQ_3 ESOS_USER_IRQ_LEVEL3
00072 #elif (MOTOR_IRQ_LEVEL_3 == 4)
00073 #define MOTOR_IRQ_3 ESOS_USER_IRQ_LEVEL4
00074 #else
00075 #error Incorrect value for MOTOR_IRQ_LEVEL_3!
00076 #error Available choices are 1 through 4 (1 being highest).
00077 #endif
00078 #else
00079 #if !(MOTOR_IRQ_LEVEL_3 >= 1 && MOTOR_IRQ_LEVEL_3 <= 7)
00080 #error Incorrect value for MOTOR_IRQ_LEVEL_3!
00081 #error Available choices are 1 through 7 (7 being highest).
00082 #endif
00083 #endif
00084
00085
00086
00087 #if (MOTOR_PRESCALER_3 == 1)
00088 #define MOTOR_PRESCALER_BITFIELD_3 T3_PS_1_1
00089 #elif (MOTOR_PRESCALER_3 == 8)
00090 #define MOTOR_PRESCALER_BITFIELD_3 T3_PS_1_8
00091 #elif (MOTOR_PRESCALER_3 == 64)
00092 #define MOTOR_PRESCALER_BITFIELD_3 T3_PS_1_64
00093 #elif (MOTOR_PRESCALER_3 == 256)
00094 #define MOTOR_PRESCALER_BITFIELD_3 T3_PS_1_256
00095 #else
00096 #error Incorrect value for MOTOR_PRESCALER_3!
00097 #error Available choices are 1, 8, 64, or 256.
00098 #endif
00099
00100
00101 #ifdef MOTOR_TIMER_USED_2
00102 #define MOTOR_OCTSEL 0
00103 #endif
00104 #ifdef MOTOR_TIMER_USED_3
00105 #define MOTOR_OCTSEL 1
00106 #endif
00107
00108
00109 #if(NUM_MOTORS_USED_3 > MAX_NUM_MOTORS_USED_3)
00110 #warn NUM_MOTORS_USED_3 exceeds the maximum!
00111 #endif