Skip to content

Unable to get Interrupt Service Routine to work #6

@glyndavidson

Description

@glyndavidson

I have a sensor which generates an interrupt every 80ms.
The interrupt pin of the sensor is connected to the rtc EVI pin.
The rtc INT pin is connected to pin2 (INT2) on my Arduino.

I wan't the rtc to capture the time of the external interrupt, send an interrupt to the Arduino, and the Arduino to then run an Interrupt Service Routine.

Here's my code:

 // (EIE) disable interrupts whilst changing settings
realClock.disableAllInterrupts();
realClock.disableHardwareInterrupt(EVI_INTERRUPT);

// (EVF) Clear any existing interrupt flags
//realClock.clearAllInterruptFlags();  
realClock.clearInterruptFlag(FLAG_EVI);

// (ECP) Enable time capturing for the interrupt - seconds and 100th seconds
realClock.setEVIEventCapture(EVI_CAPTURE_ENABLE); 

// (EHL) detect rising or falling interrupt.
realClock.setEVIEdgeDetection(RISING_EDGE);       

// (ET) set the debounce time on the interrupt.
realClock.setEVIDebounceTime(EVI_DEBOUNCE_NONE);  

// (ERST) don't reset the clock on the interrupt 
realClock.setEVICalibration(false);

// (EIE) enable interrupts now that all of the settings have been configured
realClock.enableHardwareInterrupt(EVI_INTERRUPT); 

// attach the interrupt service routine
attachInterrupt(2, rtcInterruptHandler, CHANGE);

I have confirmed that the rtc is capturing the timestamp for the external event interrupt from the sensor every 80ms. However, the Arduino is not running the interrupt service routine. Not sure if the rtc is sending an interrupt or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions