#include "C:\RS\Ladicka\main.h"
#define krok 1
#define vstup C1OUT

void main()
{
   int16 n;
   short ENABLE;
   short off;
   
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(A0_VR_A1_VR);
   setup_vref(VREF_LOW|0);

   while(TRUE)
   {
      off=0;
      ENABLE=1;
      while(vstup);
      for(n=1;ENABLE;n++)
      {
         delay_ms(krok);
         if(vstup)off=1;
         if((!vstup)&(off))ENABLE=0;
      }
      printf("Doba mezi stisknutim byla %5.3w s.\n\r",n-1);
   }

}