User Tools

Site Tools

한국어

moacon:extintevent:index

extIntEvent

void extIntEvent(u8 extIntPort)

extIntPort : The port on which the interrupt was triggered

The interrupt service routine for the external interrupts. This function is executed when any of the external events are triggered. extIntPort is the port on which the external interrupt was triggered.

External Interrupts

The MOACON has the ability to receive external interrupts on ports 10 through 17. When an interrupt is received, an interrupt service routine (ISR) is executed. A Digital Input Module can be installed in slot +10 to receive interrupt signals.

#include "moacon500.h"
void cmain(void)
{
 startExtIntEvent (10,0);             //Port 10, triggerd on rising edge
 startExtIntEvent (11,2);             //Port 11, triggered on rising and falling edge
 while(1) //Run forever
 {
   printf("Main Routine \r\n");
   delay(1000);
 }
}
void extIntEvent(u8 extIntPort)
{
 switch(extIntPort)
 {
 case 10:                             //If event was triggered on port 10
   printf("Interrupt on port 10 \r\n");
   break;
 case 11:                             //If event was triggered on port 11
   printf("Interrupt on port 11 \r\n");
   break;
 }
}

go MOACON home

moacon/extintevent/index.txt · Last modified: 2016/04/14 11:07 (external edit)