229 |
toman |
1 |
#include "C:\RS\Prog\alarm\alarm.h" |
|
|
2 |
|
|
|
3 |
#int_RDA |
|
|
4 |
void RDA_isr(void) |
|
|
5 |
{ |
|
|
6 |
while(TRUE) |
|
|
7 |
{ |
|
|
8 |
output_high(PIN_A2); |
|
|
9 |
delay_ms(500); |
|
|
10 |
output_low(PIN_A2); |
|
|
11 |
delay_ms(500); |
|
|
12 |
} |
|
|
13 |
} |
|
|
14 |
|
|
|
15 |
void main() |
|
|
16 |
{ |
|
|
17 |
int1 pipak; |
|
|
18 |
|
|
|
19 |
port_b_pullups(TRUE); |
|
|
20 |
setup_adc_ports(NO_ANALOGS); |
|
|
21 |
setup_adc(ADC_OFF); |
|
|
22 |
setup_psp(PSP_DISABLED); |
|
|
23 |
setup_spi(SPI_SS_DISABLED); |
|
|
24 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
25 |
setup_timer_1(T1_DISABLED); |
|
|
26 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
27 |
setup_comparator(NC_NC_NC_NC); |
|
|
28 |
setup_vref(FALSE); |
|
|
29 |
|
|
|
30 |
enable_interrupts(INT_RDA); |
|
|
31 |
enable_interrupts(GLOBAL); |
|
|
32 |
|
|
|
33 |
While(TRUE) |
|
|
34 |
{ |
|
|
35 |
if(!input(PIN_B0)) |
|
|
36 |
{ |
|
|
37 |
while(!input(PIN_B0)) |
|
|
38 |
{ |
|
|
39 |
output_high(PIN_A3); |
|
|
40 |
delay_ms(500); |
|
|
41 |
output_low(PIN_A3); |
|
|
42 |
delay_ms(500); |
|
|
43 |
} |
|
|
44 |
} |
|
|
45 |
else |
|
|
46 |
{ |
|
|
47 |
while(TRUE) |
|
|
48 |
{ |
|
|
49 |
delay_us(200); |
|
|
50 |
pipak=~pipak; // Membrana reproduktoru sem/tam |
|
|
51 |
if(pipak) |
|
|
52 |
{ |
|
|
53 |
output_high(PIN_A4); |
|
|
54 |
output_low(PIN_A5); |
|
|
55 |
} |
|
|
56 |
else |
|
|
57 |
{ |
|
|
58 |
output_low(PIN_A4); |
|
|
59 |
output_high(PIN_A5); |
|
|
60 |
} |
|
|
61 |
} |
|
|
62 |
} |
|
|
63 |
} |
|
|
64 |
} |