#use "default.h"

/*
	SC1INT1.C

	CM71xx/Z1 and CM72xx/Z2

   This sample program show the use of the /INT1 interrupt line.
	INT1 is set to receive one interrupt when /INT1 is low.
	Note that INT1 is level sensitive.
*/

void set_int1();
int int1data;
main()
{
	 int1data = 0x0000;
    set_int1();

    printf("Touch /INT1 to ground to generate one interrupt.\n");  
    while(1)
    {
    	  hitwd();
        runwatch();
		  if(int1data == 0x1234)
		  {
		  		int1data = 0x0000;
		  		printf("Received one INT1 interrupt !!!\n");
				printf("Execute function set_int1() from the watch\n");
				printf("window to reload INT1.\n");
		  }			
    }
}

// void set_int1()
// Enable INT1 interrupt.
void set_int1()
{
   DI();
   ISET(ITC, 1);        // enable INT1 interrupt
   EI();
}

#INT_VEC INT1_VEC int1test

interrupt reti int1test()
{
	 IRES(ITC, 1);			// turn off INT1 interrupt	
	 int1data = 0x1234;
}

