Subversion Repositories svnkaklik

Rev

Rev 854 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 854 Rev 870
Line 1... Line 1...
1
#include "main.h"
1
#include "main.h"
2
 
2
 
3
#use fast_io (D)
3
#use fast_io (D)
4
 
4
 
5
#define LED PIN_E1  //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
-
 
6
 
-
 
7
#define START  PIN_D4
5
#define START  PIN_D4
8
#define STOP1  PIN_D5
6
#define STOP1  PIN_D5
9
#define STOP2  PIN_D7
7
#define STOP2  PIN_D7
10
 
8
 
-
 
9
#define FIRE_DETECT  PIN_D6
-
 
10
 
11
 
11
 
12
void main()
12
void main()
13
{
13
{
14
 
14
 
15
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
15
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
Line 23... Line 23...
23
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
23
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
24
   setup_ccp1(CCP_OFF);
24
   setup_ccp1(CCP_OFF);
25
   setup_comparator(NC_NC_NC_NC);
25
   setup_comparator(NC_NC_NC_NC);
26
   setup_vref(FALSE);
26
   setup_vref(FALSE);
27
 
27
 
28
    //Example blinking LED program
28
   SET_TRIS_D( 0b00000100 );
-
 
29
 
29
    while(true){
30
  while(true)
-
 
31
  {
30
      output_low(LED);
32
      delay_ms(50);
31
      delay_ms(1000);
33
      output_low(START);
32
      output_high(LED);
34
      output_low(STOP1);
33
      delay_ms(1000);
35
      output_low(STOP2);
34
    }
-
 
35
 
36
 
36
// Mode 1
37
// Mode 1
37
      
38
/*      
38
      delay_ms(50);
39
      delay_ms(50);
39
      output_low(START);
40
      output_low(START);
40
      output_low(STOP1);
41
      output_low(STOP1);
41
      output_low(STOP2);
42
      output_low(STOP2);
42
            
43
            
Line 47... Line 48...
47
 
48
 
48
      output_low(STOP1);
49
      output_low(STOP1);
49
      output_low(STOP2);
50
      output_low(STOP2);
50
      output_low(START);
51
      output_low(START);
51
 
52
 
52
 
53
*/
53
// mode 2
54
// mode 2
54
 
55
 
55
      output_high(STOP2);  // Merime jenom jednim kanalem (druhy musi byt v H)
56
      output_high(STOP2);  // Merime jenom jednim kanalem (druhy musi byt v H)
-
 
57
      while(!input(FIRE_DETECT));
56
      
58
 
57
      output_high(START);
59
      output_high(START);
58
      output_low(START);
60
      output_low(START);
59
      delay_us(150);
61
      delay_us(150);
60
      
62
      
61
      output_high(STOP1);
63
      output_high(STOP1);
Line 66... Line 68...
66
      output_low(STOP1);
68
      output_low(STOP1);
67
      delay_us(10);
69
      delay_us(10);
68
      
70
      
69
      output_high(STOP1);
71
      output_high(STOP1);
70
      output_low(STOP1);
72
      output_low(STOP1);
71
      delay_us(1);
73
  }
72
}
74
}