135 |
jicha |
1 |
#include "C:\RS\Ladicka2\main.h" |
|
|
2 |
#define vstup C1OUT |
|
|
3 |
#define krok 1 |
|
|
4 |
|
|
|
5 |
void main() |
|
|
6 |
{ |
|
|
7 |
int16 n; |
|
|
8 |
|
|
|
9 |
setup_adc_ports(NO_ANALOGS); |
|
|
10 |
setup_adc(ADC_OFF); |
|
|
11 |
setup_psp(PSP_DISABLED); |
|
|
12 |
setup_spi(SPI_SS_DISABLED); |
|
|
13 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
14 |
setup_timer_1(T1_DISABLED); |
|
|
15 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
16 |
setup_comparator(A0_VR_A1_VR); |
|
|
17 |
setup_vref(VREF_HIGH|0); |
|
|
18 |
|
|
|
19 |
while(TRUE) |
|
|
20 |
{ |
|
|
21 |
n=0; |
|
|
22 |
while(vstup) |
|
|
23 |
{ |
|
|
24 |
n++; |
|
|
25 |
delay_ms(krok); |
|
|
26 |
} |
|
|
27 |
while(!vstup) |
|
|
28 |
{ |
|
|
29 |
n++; |
|
|
30 |
delay_ms(krok); |
|
|
31 |
} |
|
|
32 |
printf("%Lu ms\n\r",n); |
|
|
33 |
} |
|
|
34 |
} |