Rev Author Line No. Line
4370 jacho 1 #include "main.h"
2  
3  
4 #define MAX 1024
5  
6 // Vystup PWM je na nozickach C1 a C2
7  
8 void main()
9 {
10 int16 pwm;
11  
12 setup_adc_ports(NO_ANALOGS);
13 setup_adc(ADC_OFF);
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_DIV_BY_1,255,1);
18 setup_ccp1(CCP_PWM);
19 setup_ccp2(CCP_PWM);
20 set_pwm1_duty(0);
21 set_pwm2_duty(0);
22  
23 port_b_pullups(TRUE);
24 pwm=0;
25  
26  
27 // Postupne zhasina a rozsveci stridave dve LED
28 while(TRUE)
29 {
30 while(pwm<MAX)
31 {
32 pwm++;
33 delay_ms(5);
34 set_pwm1_duty(pwm);
35 set_pwm2_duty(MAX-pwm);
36 };
37 while(pwm>0)
38 {
39 pwm--;
40 delay_ms(5);
41 set_pwm1_duty(pwm);
42 set_pwm2_duty(MAX-pwm);
43 }
44 }
45 }