This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Hardware interrupt: Level or edge triggered

Other Parts Discussed in Thread: HALCOGEN

Hi


Using Halcogen I sat up a hardware interrupt on Port A of my Hercules launchpad. Where in the code can I find the line/s that set the interrupt to be edge or level triggered?


Thanks,

Daniel

  • Daniel,

    GIO interrupt are level sensitive. Rising or Falling edge can be selected in Halcogen for a given pin.

    The corresponding code can be found in gio.c in the void gioInit(void) API.

    In the following example, GIOA_0 is used as "Rising Edge", "High Priority"

        /** @b initialize @b interrupts */

        /** - interrupt polarity */
        gioREG->POL = (uint32)((uint32)1U << 0U)   /* Bit 0 */           // Rising Edge
                    | (uint32)((uint32)0U << 1U)   /* Bit 1 */
                    | (uint32)((uint32)0U << 2U)   /* Bit 2 */
                    | (uint32)((uint32)0U << 3U)   /* Bit 3 */
                    | (uint32)((uint32)0U << 4U)   /* Bit 4 */
                    | (uint32)((uint32)0U << 5U)   /* Bit 5 */
                    | (uint32)((uint32)0U << 6U)   /* Bit 6 */

        /** - interrupt level */
        gioREG->LVLSET = (uint32)((uint32)1U << 0U)   /* Bit 0 */    //High Priority
                       | (uint32)((uint32)0U << 1U)   /* Bit 1 */
                       | (uint32)((uint32)0U << 2U)   /* Bit 2 */
                       | (uint32)((uint32)0U << 3U)   /* Bit 3 */
                       | (uint32)((uint32)0U << 4U)   /* Bit 4 */
                       | (uint32)((uint32)0U << 5U)   /* Bit 5 */
                       | (uint32)((uint32)0U << 6U)   /* Bit 6 */
                       | (uint32)((uint32)0U << 7U)   /* Bit 7 */

        /** - enable interrupts */
        gioREG->ENASET = (uint32)((uint32)1U << 0U)   /* Bit 0 */    // Interrupt Enable
                       | (uint32)((uint32)0U << 1U)   /* Bit 1 */
                       | (uint32)((uint32)0U << 2U)   /* Bit 2 */
                       | (uint32)((uint32)0U << 3U)   /* Bit 3 */
                       | (uint32)((uint32)0U << 4U)   /* Bit 4 */
                       | (uint32)((uint32)0U << 5U)   /* Bit 5 */
                       | (uint32)((uint32)0U << 6U)   /* Bit 6 */
                       | (uint32)((uint32)0U << 7U)   /* Bit 7 */

    This code correspond to the following graphic configuration:

     

     

  • Thank you Jean-Marc.