robotics/common/servo2.c File Reference

#include "servoconfig2.h"

Go to the source code of this file.

Functions

void initialize_servo_2 (void)
 Initializes the servos and Timer2.
 ESOS_USER_INTERRUPT (ESOS_IRQ_PIC24_T2)
 The servo ISR.

Variables

volatile uint16 au16_servoDur2 [NUM_SERVOS_USED_2]


Detailed Description

Author:
Thomas Donaldson
This source file defines the routines declared in servo2.h and should not be edited. All manipulation of the servo2 library should be done through servoconfig2.h; see that file for more information on configuring and using the servos.

Definition in file servo2.c.


Function Documentation

ESOS_USER_INTERRUPT ( ESOS_IRQ_PIC24_T2   ) 

The servo ISR.

Precondition:
This ISR must be initialized via InitServo2() and registered and enabled via ESOS routines in user_init(). NUM_SERVOS_USED_2 must be defined (and not exceed MAX_NUM_SERVOS_2) and each SERVO_2_PORT_x (starting from 1 and in ascending order) must be mapped in servoconfig2.h.
The ISR steps through the SERVO_2_PORT_x's and interrupts when the servo state should change. This routine will throw a run-time ASSERT() error if the specified servo duration exceeds software/physical limitations.

Definition at line 82 of file servo2.c.

void initialize_servo_2 ( void   ) 

Initializes the servos and Timer2.

Precondition:
The desired SERVO_2_PORT_x's (starting from 1 and in ascending order), CONFIG_SERVO_2_PORT_x(), NUM_SERVOS_USED_2, and SERVO_PRESCALAR_2 must be defined in servoconfig2.h.
The au16_servoDur2[] array is filled with 1.5 ms interrupts by default. Each SERVO_2_PORT_x is configured, and Timer2 is initialized and set to flag in 1ms. For ESOS users, the Timer2 interrupt is registered and enabled.

Definition at line 27 of file servo2.c.


Variable Documentation

volatile uint16 au16_servoDur2[NUM_SERVOS_USED_2]

This array specifies the "on" time of each servo pulse in terms of Timer2 ticks. Modify values in array to specify the servo's position. For example, au16_servoDur2[0] affects SERVO_2_PORT_1's duration.

Definition at line 13 of file servo2.c.


Generated on Sun Mar 15 11:14:22 2009 for PIC24 Support Libraries by  doxygen 1.5.8