HiHo I am having trouble driving both a high freq PWM and a servo control. I am using Arduino Decimilia and V11 Alpha environment
I am driving pin 6 PWM at 16Khz using the following custom timer settings to get a higher freq PWM:
TCCR1A = 0x00; // sets timer control bits to PWM Phase and Frequency Correct mode TCCR1B = 0x11; // sets timer control bits to Prescaler N = 1 (0x12 is 8 scaler) ICR1 = 0x001E0; // Upper Timer Limit (ie what to count to to kick counter) = about dec 492
But, if I add the 'ServoTimer1' Library to control a servo on Pin 10, I get a conflict. Depending on the order of the calls to set the PWM frequency or to initialise the servo pins, either my PWM or the servo is broken (wrong frequency and duty). I assume that both functions are using the same timer and I cannot get a workable setting that will make both work.
I have tried using the 'Servo' library, but the servo pulse train only runs at 12 Hz (not the usual 50 Hz).
I understand there are three timers - 2-8 bit and 1-16bit
- When I drive pin 6 PWM and use the custom settings for TCCR1A and TCCR1B, what timer am I using? Can I change this?
- Can I get either the PWM or the servo library to use a seperate timer?
- Why is the 'servo' library running at only 12 Hz?
I am using the Arduino to control a 10 Kw electric boat.
Rick Retzlaff, Saskatoon, Canada