This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hardware interrupt example

Hello! I am newbie, I am using nordic nrf51822a board. Can anyone give me hardware interrupt example code and tell me how to enable it?

Parents
  • Hi,

    Interrupts are essentially enabled by using two steps:

    • Enable the interrupt vector using NVIC_EnableIRQ(IRQ_type)
    • Set the appropriate bit in NRF_wantedperipheral->INTENSET = MASK_ENABLE;

    I'm attaching a small example on how to setup the ADC w/ISR.

    Best regards Håkon

    adc_isr_example.zip

  • Hi,

    The interrupt handler is located in the file startup_nrf51.s under the comment "; External Interrupts". These should be declared in your source file (let's say main.c) in this fashion: "void PERIPHERALX_IRQHandler(void){ .. }"

    When enabling the IRQ, using NVIC-functions, they take in the type "IRQn_Type". This is declared in nrf51.h, line 82.

Reply
  • Hi,

    The interrupt handler is located in the file startup_nrf51.s under the comment "; External Interrupts". These should be declared in your source file (let's say main.c) in this fashion: "void PERIPHERALX_IRQHandler(void){ .. }"

    When enabling the IRQ, using NVIC-functions, they take in the type "IRQn_Type". This is declared in nrf51.h, line 82.

Children
No Data
Related