Servo motor routines. More...
#include "dwengoBoard.h"
Defines | |
#define | MIN_TIME_SERVO 999 |
#define | MAX_TIME_SERVO 3449 |
#define | PERIOD 15000 |
Functions | |
void | initServo (void) |
Initialize servo functionality. | |
void | servoISR () |
void | setServoRange (BYTE servo, int minTime, int maxTime) |
Set the puls width rage of a servo. | |
void | setPosition (BYTE servo, unsigned char position) |
Set the possition of a servo. |
Servo motor routines.
Library to control servo motors.
void initServo | ( | void | ) |
Initialize servo functionality.
This routine initializes servo functionality of the Dwengo board. It configures the servo pins as digital outputs. It also configures timer1 and dispatches the servo interrupt service routine using the dwengo interrupt librairy. The minimum and maximum pulse widths for both servos are set to 0.7 ms and 2.3 ms by default.
void setPosition | ( | BYTE | servo, |
unsigned char | position | ||
) |
Set the possition of a servo.
Sets the possition of a servo. The possition is expressed as a number between 0 and 255. Possition 0 corresponds with a pulse width equal to the minimum pulse width. Possition 255 corresponds to a pulse width equal to the maximum pulse width.
servo | Number specifing the servo: 1 for SERVO1 and 2 for SERVO2 |
position | Number that specifies the possition of the servo. 0 corresponds to the minimal pulse width 255 corresponds to the maximal pulse width. |
void setServoRange | ( | BYTE | servo, |
int | minTime, | ||
int | maxTime | ||
) |
Set the puls width rage of a servo.
This routine sets the minimum and maximum puls width for a servo. Both times are expressed in units of 83.33ns. The initServos routine by default sets these times to 0.7 ms and 2.3 ms respectively.
servo | Number specifing the servo: 1 for SERVO1 and 2 for SERVO2 |
minTime | Minimum pulse width expressed in units of 83.33ns. |
maxTime | Maximum pulse width expressed in units of 83.33ns. |