Monday, February 4, 2013

Single Wire Motor Control (Stop, CW and CCW)


 this is concept how to control a motor to moving Clock wise, Counter Clock wise and Stop just using single pin from PIC.
Output High: CW
Output Low: CCW
High impedance / configure as input pin: Stop

D1,D2 3.3v zener doide

the program: using hi-tech c compliler

void main() 

TRISB=0b11100001; 
 PORTB=0b11100000; 
OPTION_REG=0b01111111; 

    while(1) 
   { 
        if(!RB5) 
       { TRISB0=0; 
          RB0=1; }

       else if(!RB6) 
      { TRISB0=0; 
         RB0=0; }

       else if(!RB7) 
      { TRISB0=1; 
        RB0=0;  }
     } 
}