#include "D:\MLAB\Designs\STOPWATCH02A\SW\test\main.h"

#define LED1 PIN_A1
#define LED2 PIN_A2

#int_TIMER0
void  TIMER0_isr(void) 
{
   Output_low(LED2);
}

/*#int_RB
void  RB_isr(void) 
{
   output_high(LED2);  
}*/


void main()
{
unsigned int8 last;

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   
   port_b_pullups(TRUE);

//   enable_interrupts(INT_RB);
   enable_interrupts(GLOBAL);

   last=input_b();
   
   while(true)
   {
      Output_toggle(LED1);
      Delay_ms(100);
      if(last!=Input_b()) output_high(LED2);  
      last=input_b();
   }
}