Go Down

Topic: Problem use Interrupt 4 or 5 wit DCF77 and Arduino mega (Read 39 times) previous topic - next topic

Environment: Win7, Arduino mega2560, IDE 1.0.5, DCF77 lib 0.9.8
Attached Hardware: Only the DCF 77 modul

My problem is that i must use int 4 or int 5 for DCF77, but it does not work with them.
With INT 0 or 1 everything works fine.


I use the example sketch from that comes with DCF lib  "DCFBinaryStream.ino"

Following behavior:
If  I use INT 4 on PIN 19 and upload the sketch the Led13 is blinking and ererythin seems to be OK. But if i open the Monitor window the led 13 stop's.
When i close the monitor window the led 13 is still off.
If I reset or Power Off/on the led 13 is still not blinking until I upload the sketch again.

If  I use INT 5 on PIN 18 the led 13 do not blink in anyway.

Does have anybody an idea where the problem is.


/*
 * DCFBinaryStream.ino
 * example code illustrating time synced from a DCF77 receiver
 * Thijs Elenbaas, 2012
 * This example code is in the public domain.
 
  This example shows the binary stream generated by the
  pulse train coming from the DCF decoder and the resulting
  time
  In order for this example to give output from the DCF library,
  make sure that logging is turned on in the DCF library. You can
  do this by adding the   #define VERBOSE_DEBUG 1   in Utils.cpp.
 */


#include <DCF77.h>       //https://github.com/thijse/Arduino-Libraries/downloads
#include <Time.h>        //http://www.arduino.cc/playground/Code/Time

#define DCF_PIN 19            // Connection pin to DCF 77 device
#define DCF_INTERRUPT 4       // Interrupt number associated with pin

time_t time;
DCF77 DCF = DCF77(DCF_PIN,DCF_INTERRUPT);

void setup() {
 Serial.begin(9600);
 Serial.println("1   - binary 1 corresponding to long pulse");
 Serial.println("0   - binary 0 corresponding to short pulse");
 Serial.println("BF  - Buffer is full at end of time-sequence. This is good");
 Serial.println("EoB - Buffer is full before at end of time-sequence");
 Serial.println("EoM - Buffer is not yet full at end of time-sequence");
 DCF.Start();
}

void loop() {
   delay(1000);
   time_t DCFtime = DCF.getTime();
   if (DCFtime!=0) {
      digitalClockDisplay(DCFtime);
   }   
}

void digitalClockDisplay(time_t _time){
  tmElements_t tm;   
  breakTime(_time, tm);

  Serial.println("");
  Serial.print("Time: ");
  Serial.print(tm.Hour);
  Serial.print(":");
  printDigits(tm.Minute);
  Serial.print(":");
  printDigits(tm.Second);
  Serial.print(" Date: ");
  Serial.print(tm.Day);
  Serial.print(".");
  Serial.print(tm.Month);
  Serial.print(".");
  Serial.println(tm.Year+1970);
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
  Serial.print('0');
 Serial.print(digits);
  }

Wolfgang

Go Up