tlc_servos.h File Reference

TLC servo functions. More...

#include <avr/io.h>
#include "Tlc5940.h"

Go to the source code of this file.

Defines

#define SERVO_MAX_ANGLE   180
 The maximum angle of the servo.
#define SERVO_MIN_WIDTH   204
 The 1ms pulse width for zero degrees (0 - 4095).
#define SERVO_MAX_WIDTH   410
 The 2ms pulse width for 180 degrees (0 - 4095).
#define SERVO_TIMER1_TOP   20000
 The top value for XLAT and BLANK pulses.
#define SERVO_TIMER2_TOP   77
 The top value for GSCLK pulses.

Functions

void tlc_initServos (uint8_t initAngle)
 Initializes the tlc.
void tlc_setServo (TLC_CHANNEL_TYPE channel, uint8_t angle)
 Sets a servo on channel to angle.
uint8_t tlc_getServo (TLC_CHANNEL_TYPE channel)
 Gets the current angle that channel is set to.
uint16_t tlc_angleToVal (uint8_t angle)
 Converts and angle (0 - SERVO_MAX_ANGLE) to the inverted tlc channel value (4095 - 0).
uint8_t tlc_valToAngle (uint16_t value)
 Converts an inverted tlc channel value (4095 - 0) into an angle (0 - SERVO_MAX_ANGLE).


Detailed Description

TLC servo functions.


Define Documentation

#define SERVO_MAX_ANGLE   180

The maximum angle of the servo.

#define SERVO_MAX_WIDTH   410

The 2ms pulse width for 180 degrees (0 - 4095).

#define SERVO_MIN_WIDTH   204

The 1ms pulse width for zero degrees (0 - 4095).

#define SERVO_TIMER1_TOP   20000

The top value for XLAT and BLANK pulses.

This is with the div8 prescale, so $\displaystyle f_{PWM} = \frac{f_{osc}}{2 * 8 * SERVO\_TIMER1\_TOP} $ The default is 20000, which corresponds to 50Hz.

#define SERVO_TIMER2_TOP   77

The top value for GSCLK pulses.

Related to SERVO_TIMER1_TOP by $\displaystyle SERVO\_TIMER2\_TOP = \frac{2 * 8 * SERVO\_TIMER1\_TOP}{4096} - 1 $ The default is 77.


Generated on Thu May 7 01:17:13 2009 for Arduino Tlc5940 Library by  doxygen 1.5.8