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