#include "C:\RS\Schmitt\main.h"
#define mic input(PIN_A3)
#define LED_ON output_low(PIN_A0)
#define LED_OFF output_high(PIN_A0)

void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   while(TRUE)
   {
      while(mic);
      while(!mic);
      while(mic)
      {
         set_timer1(0);
         LED_ON;
         while(mic);
      }
      while(!mic)
      {
         LED_OFF;
         while(!mic);
      }
      printf("Perioda %5Lu us.\n\r",get_timer1());
   }
}