#include "motorconfig3.h"
Go to the source code of this file.
Functions | |
void | update_motor_3 (uint8 u8_motor, uint8 u8_direction, uint16 u16_duration) |
void | initialize_motor_3 (void) |
ESOS_USER_INTERRUPT (ESOS_IRQ_PIC24_T3) |
Definition in file motor3.c.
ESOS_USER_INTERRUPT | ( | ESOS_IRQ_PIC24_T3 | ) |
void initialize_motor_3 | ( | void | ) |
Initializes the selected motors. Each motor is associated with an output compare, and each output compare is initialized to a 100 count duration until update_motor_3() is called.
This function is used to update each motor with a new direction and PWM duration. The motor (see Motor References) and direction (see Motor States) parameters are already defined, and the duration parameter is in terms of Timer ticks, which can be easily calculated with usToU16Ticks(). This function will ASSERT() if an invalid duration or motor is passed. Also, a bit mask is applied to the direction parameter so any editing of Motor States should be done with care.
As an example, to set motor 2 to 90% speed in reverse:
update_motor_3(MOTOR_3_2, MOTOR_REVERSE, usToU16Ticks(360, MOTOR_PRESCALER_3));