2.10 External Interrupt Driver

Overview

Interrupt gets generated on an external event like a positive edge or a negative edge pulse on a selected input pin, these interrupts are named as INT0, INT1 and so on.

Features

  • Selecting the input pin for external interrupt enables the user to configure the edge detect type i,e either positive or negative edge event for which the interrupt gets triggered.
  • Custom name can be added for each external interrupt.

2.10.1 Module Documentation

2.10.1.1 External Interrupt Driver

External Interrupt Driver is used to configure the dedicated INTx pin to interrupt on negative or positive edge using dsPIC MCUs.

2.10.1.1.1 Module description

External Interrupt Driver is used to configure the dedicated INTx pin to interrupt on negative or positive edge using dsPIC MCUs.

Data structures
Enumerations
  • enum EXT_INT { INT0 }

    Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

Functions

2.10.1.1.2 Function Documentation

EXT_INT0_Callback()

void EXT_INT0_Callback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using EXT_INT_CallbackRegister.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
none
Returns:

none

EXT_INT_CallbackRegister()

void EXT_INT_CallbackRegister (enum EXT_INT interruptNum, void(*)(void) handler)

This function can be used to override default callback and to define custom callback for EXT_INT event.

Precondition:

EXT_INT_Initialize() must be called for the associated function to work.

Parameters:
in interruptNum

- External interrupt number

in handler

- Address of the callback function

Returns:

none

EXT_INT_Deinitialize()

void EXT_INT_Deinitialize (void )

Deinitializes the EXT_INT to POR values.

Parameters:
none
Returns:

none

EXT_INT_Initialize()

void EXT_INT_Initialize (void )

Initializes EXT_INT module.

Parameters:
none
Returns:

none

EXT_INT_InterruptDisable()

void EXT_INT_InterruptDisable (enum EXT_INT interruptNum)

Disable the external interrupt for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none

EXT_INT_InterruptEnable()

void EXT_INT_InterruptEnable (enum EXT_INT interruptNum)

Enable the external interrupt for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none

EXT_INT_InterruptFlagClear()

void EXT_INT_InterruptFlagClear (enum EXT_INT interruptNum)

Clear the external interrupt flag for pins.

Parameters:
in interruptNum

- External interrupt number

Returns:

none

EXT_INT_NegativeEdgeSet()

void EXT_INT_NegativeEdgeSet (enum EXT_INT interruptNum)

Sets the external interrupt to negative edge detect.

Parameters:
in interruptNum

- External interrupt number

Returns:

none

EXT_INT_PositiveEdgeSet()

void EXT_INT_PositiveEdgeSet (enum EXT_INT interruptNum)

Sets the external interrupt to positive edge detect.

Parameters:
in interruptNum

- External interrupt number

Returns:

none

2.10.1.1.3 Enumeration Type Documentation

EXT_INT

enum EXT_INT

Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

INT0

External Interrupt - INT0.

2.10.1.1.4 Variable Documentation

External_Interrupt

const struct EXT_INTERRUPT_INTERFACE External_Interrupt

Structure object of type EXT_INTERRUPT_INTERFACE with the custom name given by the user in the Melody Driver User interface.

The default name e.g. External_Interrupt can be changed by the user in the EXT_INTERRUPT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.10.2 Class Documentation

2.10.2.1 EXT_INTERRUPT_INTERFACE Struct Reference

Structure containing the function pointers of EXT_INTERRUPT driver.

2.10.2.1.1 Detailed Description

Structure containing the function pointers of EXT_INTERRUPT driver.

#include <ext_int_interface.h>

Public Attributes

2.10.2.1.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

ext_int_interface.h

CallbackRegister

void(* CallbackRegister) (enum EXT_INT interruptNum, void(*CallbackHandler)(void))

Pointer to EXT_INT_CallbackRegister.

2.10.3 File Documentation

2.10.3.1 source/ext_int.h File Reference

This is the generated driver header file for the EXT_INT driver.

#include <xc.h>
#include "ext_int_types.h"
#include "ext_int_interface.h"

2.10.3.1.1 Functions

2.10.3.1.3 Detailed Description

This is the generated driver header file for the EXT_INT driver.

EXT_INT Generated Driver Header File

2.10.3.2 source/ext_int_interface.h File Reference

#include "ext_int_types.h"

2.10.3.2.1 Data structures

2.10.3.2.2 Detailed Description

EXT_INTERRUPT Generated Driver Interface Header File

2.10.3.3 source/ext_int_types.h File Reference

This is the generated driver types header file for the EXT_INTERRUPT driver.

2.10.3.3.1 Enumerations

  • enum EXT_INT { INT0 }

    Defines the list of custom names for the External Interrupt Pins selected in MCC Melody user interface.

2.10.3.3.2 Detailed Description

This is the generated driver types header file for the EXT_INTERRUPT driver.

EXT_INTERRUPT Generated Driver Types Header File