chipKIT® Development Platform

Inspired by Arduino™

MakeshiftServo - Timer Question

Created Thu, 07 Jul 2011 20:09:37 +0000 by red24dog


red24dog

Thu, 07 Jul 2011 20:09:37 +0000

The MakeshiftServo.h code includes the qualification that analogWrite of PWM associated with the timer [used in the servo code]. And that timers are seized in groups of 12 with sequence defined in timers.h.

OK, try this. I've named it "MakeshiftServo" so it won't be mistaken for an "official" version.

  1. Where is timers.h? Its not in my Arduino 0022 (chipKit modified) installation?
  2. Simply, what of the existing PWM on pins 3, 5, 6, 9, 10 are available when a servo (up to 8) are attached by this library?

red24dog


davec

Sat, 09 Jul 2011 00:43:40 +0000

The MakeshiftServo.h code includes the qualification that analogWrite of PWM associated with the timer [used in the servo code]. And that timers are seized in groups of 12 with sequence defined in timers.h.

  1. Where is timers.h? Its not in my Arduino 0022 (chipKit modified) installation?

All the comments about the implementation in that title block apply to the AVR original implementation of Servo, not MakeshiftServo, so just ignore them. Actually I think they're out of date for the AVR implementation as well. :) This implementation uses Timer3 and OC1 only.

  1. Simply, what of the existing PWM on pins 3, 5, 6, 9, 10 are available when a servo (up to 8) are attached by this library?

The PIC32 PWM implementation uses the same OC1 as MakeshiftServo. On the UNO32 this is mapped to pin 3 so you will not be able to use pin 3 for PWM either. See wiring_analog.c and pins_arduino_pic32_uno.cxx in the PIC32 source. All the other PWM pins should still work, within limits.