Home

Defines | Functions

dwengoServo.h File Reference

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.

Detailed Description

Servo motor routines.

Library to control servo motors.


Function Documentation

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.

Parameters:
servoNumber specifing the servo: 1 for SERVO1 and 2 for SERVO2
positionNumber 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.

Parameters:
servoNumber specifing the servo: 1 for SERVO1 and 2 for SERVO2
minTimeMinimum pulse width expressed in units of 83.33ns.
maxTimeMaximum pulse width expressed in units of 83.33ns.
 All Data Structures Files Functions Variables Defines

Generated on Wed Dec 25 2013 23:03:08 for Dwengo library by doxygen 1.7.3