limit switch for dc gearmotor

Thread Starter

muaz89

Joined Feb 4, 2012
6
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);
}
 

Attachments

praondevou

Joined Jul 9, 2011
2,942
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?
 
Top