Subversion Repositories svnkaklik

Rev

Rev 853 | Rev 870 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
854 kaklik 1
#include "main.h"
853 kaklik 2
 
3
#use fast_io (D)
4
 
5
#define LED PIN_E1  //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
6
 
7
#define START  PIN_D4
8
#define STOP1  PIN_D5
9
#define STOP2  PIN_D7
10
 
11
 
12
void main()
13
{
14
 
15
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
16
   setup_adc(ADC_CLOCK_DIV_2);
17
   setup_psp(PSP_DISABLED);
18
   setup_spi(SPI_SS_DISABLED);
19
   setup_wdt(WDT_OFF);
20
   setup_timer_0(RTCC_INTERNAL);
21
   setup_timer_1(T1_DISABLED);
22
   setup_timer_2(T2_DISABLED,0,1);
23
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
24
   setup_ccp1(CCP_OFF);
25
   setup_comparator(NC_NC_NC_NC);
26
   setup_vref(FALSE);
27
 
28
    //Example blinking LED program
29
    while(true){
30
      output_low(LED);
31
      delay_ms(1000);
32
      output_high(LED);
33
      delay_ms(1000);
34
    }
35
 
36
// Mode 1
37
 
38
      delay_ms(50);
39
      output_low(START);
40
      output_low(STOP1);
41
      output_low(STOP2);
42
 
43
      output_high(START);     // start of time measurement
44
 
45
      output_high(STOP2);
46
      output_high(STOP1);
47
 
48
      output_low(STOP1);
49
      output_low(STOP2);
50
      output_low(START);
51
 
52
 
53
// mode 2
54
 
55
      output_high(STOP2);  // Merime jenom jednim kanalem (druhy musi byt v H)
56
 
57
      output_high(START);
58
      output_low(START);
59
      delay_us(150);
60
 
61
      output_high(STOP1);
62
      output_low(STOP1);
63
      delay_us(1);
64
 
65
      output_high(STOP1);
66
      output_low(STOP1);
67
      delay_us(10);
68
 
69
      output_high(STOP1);
70
      output_low(STOP1);
71
      delay_us(1);
72
}