Lost
Now you lost me...
What is it that you are trying to do?
Motor forward when pin_3=0 and motor reversre when pin_3=1?
Please post a drawing of your hardware. Even if it's a sketch it will help much more than 1000 words...
Please also try
Code:
if (pin_3==0)
{
// blink led
}
else
{
// blink another led
}
Why testing for 1 AND 0 on an input pin??
If it's not a 1 it has to be 0 or what else do you expect?? 0.5
when checking the voltage on the pin, i saw that there's a 5v on without any input on it .
That's good news. Did you reed the datasheet of the 89C52? What is it saying about Port 3? If you still has doubts about the status of that port try a resistor to GND and measure if it source current.
Are you sure you µP passes the
Code:
if (pin_3==1)
{
// do whatever
}
I bet it's not because it's stuck somewhere in your "move forward" part.
Try a little program that generate pulses on a output pin when pin_3==0.
At the start of the endless loop allways drive the testpin low.
Replace the "move forward" code with just one command do drive the testpin high.
Now connect a scoop to the testpin and you should see pulses when pin_3 is low and a continous low signal when pin_3 is high.
If that's ok replace the pin_3==0 part with pin_3==1 and it still should produce pulses but now with pin_3 high and a continous low signal when pin_3 is low.
If that's also ok try the If/else code above on two different testpins. Don't forget do drive both pins low at the start of the endless loop.
NOT TWO if statements; ONE if/else statement!!!!
the motor moves without putting a signal on it ...
That's even better news. Ladies and Gentlemen, the invention of this brand-new century: The self-running-motor