Subversion Repositories svnkaklik

Rev

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

Rev 371 Rev 372
Line 1... Line 1...
1
#include "motor.h"
1
#include "motor.h"
2
//#use i2c(Slave,Fast,sda=PIN_B1,scl=PIN_B4,force_hw,address=0xA0) // Motor 1
2
//#use i2c(Slave,Fast,sda=PIN_B1,scl=PIN_B4,force_hw,address=0xA0) // Motor 1
3
//#use i2c(Slave,Fast,sda=PIN_B1,scl=PIN_B4,force_hw,address=0xA2) // Motor 2
3
#use i2c(Slave,Fast,sda=PIN_B1,scl=PIN_B4,force_hw,address=0xA2) // Motor 2
4
 
4
 
5
#define H1 PIN_A1
5
#define H1 PIN_A1
6
#define L1 PIN_A2
6
#define L1 PIN_A2
7
#define H2 PIN_A3
7
#define H2 PIN_A3
8
#define L2 PIN_A4
8
#define L2 PIN_A4
Line 44... Line 44...
44
   setup_oscillator(OSC_8MHZ|OSC_INTRC);
44
   setup_oscillator(OSC_8MHZ|OSC_INTRC);
45
 
45
 
46
   enable_interrupts(GLOBAL);
46
   enable_interrupts(GLOBAL);
47
   enable_interrupts(INT_SSP);
47
   enable_interrupts(INT_SSP);
48
 
48
 
49
   command=0;  // zastaveni po resetu
49
   command=-128;  // zastaveni po resetu
50
 
50
 
51
   while(true)
51
   while(true)
52
   {
52
   {
53
 
53
 
54
      if ((0==command) || (command>127) || (command<-127)) // prikaz na odpojeni mustky nebo chybna hodnota
54
      if (command==-128) // prikaz na odpojeni mustku nebo chybna hodnota
55
      {
55
      {
56
         output_low(H1);      // stop
56
         output_a(0);   // volnobeh
57
         output_low(H2);
-
 
58
         output_low(L1);
-
 
59
         output_low(L2);
-
 
60
         continue;
57
         continue;
61
      };
58
      };
62
 
59
 
63
      speed=command+127;   // posunuti 0 pro zaporna cisla
60
      speed=command+127;   // posunuti 0 pro zaporna cisla
64
 
61