limit switch for dc gearmotor

Discussion in 'The Projects Forum' started by muaz89, Mar 18, 2012.

  1. muaz89

    Thread Starter New Member

    Feb 4, 2012
    6
    0
    hi guys..i have a problem for my circuit to conducting dc gear motor clockwise or anticlockwise using driver l293d, input from limit switches by PIC 16F877A..I had programmed my PIC to follow limit switch to control motor but didn't work..:(

    my program like this:

    #include <16f877a.h>
    #use delay(clock=20000000)
    #fuses hs,nowdt,nolvp,noprotect
    void main()
    {
    if(input(pin_c0)==0)
    {
    output_low(pin_a1);//m1 stop
    output_high(pin_a0);//m1 forward

    }
    else
    {
    output_low(pin_a0);//m1 stop
    output_high(pin_a1);//m2 forward

    }while(1);
    }
     
  2. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    More experienced programmers may correct me, but how do get out of the while(1) at the end? Through an interrupt?

    Does it compile correctly or do you get an error from the compiler/linker etc?

    What exactly doesn't work?
     
Loading...