Combining AFMotor and DCF77: Problem w/ registers?

Hi everybody,

I am currently trying to build a clock using two stepper motors for hours and minutes driven by the Adafruit Motor Shield. The time is being received by a DCF77 radio receiver from Conrad (Germany).
Therefore, I make use of the AGMotor library and the DCF77 code found at gonium.net/md/2007/01/06/arduino-dcf77-v02-released/.

The motor at stepper port 2 works fine, but stepper 1 doesn't move at all. After playing around with the code a litte bit I discovered that stepper 1 can be moved, but only before running the Dcf77Init routine. Digging a bit deeper in the code, I found out that both libraries are using the same registers on my Diecimilia.

From AFMotor.cpp:

    TCCR2A |= _BV(COM2A1) | _BV(WGM20) | _BV(WGM21); // fast PWM, turn on oc2a
    TCCR2B = freq & 0x7;

From DCF77 clock.pde:

  TCCR2B |= (1<<CS22);    // turn on CS22 bit
  TCCR2B &= ~((1<<CS21) | (1<<CS20));    // turn off CS21 and CS20 bits

As I have absolutely no experience with registers, I'm wondering if anyone else in this forum is able to help me and make the both libraries play nicely together.

Greets,

Daniel

I posted a DCF77 library that uses timer1 so that should work with your AFmotor code that uses timer2.

The code is in this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231336382

The DCF77 output connects to pin 8.