User Tools

Site Tools

한국어

moacon:startextintevent:index

startExtIntEvent

void startExtIntEvent(u8 extIntPort, u16 extIntType)

extIntPort : The port to use as an external interrupt port (10~17)
extIntType: 0=Rising Edge, 1=Falling Edge, 2=Rising and Falling Edge

Tells the MOACON to configure extIntPort as an external interrupt port. extIntType configures the interrupt to trigger when turned on (0), when turned off(1), or when turned on or off (2).

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/startextintevent/index.txt · Last modified: 2016/04/14 11:07 (external edit)