shaiqbashir
- 27th April 2006, 16:12
Hi Guys!
well this is my first post on this forum. I hope that you guys will help me as much as possible. Im making a certain robot for which i have used Stepper motors for the drive wheels. Im posting the coding below. this coding will make the motor to run 20 revolutions and then stop. have a look at this:
TrisB=%00000000
y var byte
x var byte
low portB.4
low portB.5
low portB.6
low portB.7
start:
for x= 0 to 20
for y=1 to 50
high portB.1
low portB.0
low portB.2
high portB.3
pauseus 1500
high portB.3
high portB.0
low portB.1
low portB.2
pauseus 1500
high portB.0
low portB.1
high portB.2
low portB.3
pauseus 1500
high portB.2
low portB.0
high portB.1
low portB.3
pauseus 1500
next y
next x
end
according to this program the motor will be running in TWO PHASE MODE. now the problem is this that we have to detect a white reflector tape line to a certain point using two LED-Phototransistor sensors. When both the sensors will signal high output the motor has to stop and move further. Now the thing is that how i should use this statement
if (portB.0=1) and (portB.1=1) then start
start:
some other routine to perform
I want to work in the way im writing below:
The robot should start running straight first. As soon as it detects the white reflector tape on both the sensor pins, it should go to some other routine and discontinued the previous one. and if it has not detect that yet than it should keep moving forward.
How i can put this If condition in the above coding.
I shall be thankful to u for ur quick and effective reply.
Regards
Take carez
Good Bye!
well this is my first post on this forum. I hope that you guys will help me as much as possible. Im making a certain robot for which i have used Stepper motors for the drive wheels. Im posting the coding below. this coding will make the motor to run 20 revolutions and then stop. have a look at this:
TrisB=%00000000
y var byte
x var byte
low portB.4
low portB.5
low portB.6
low portB.7
start:
for x= 0 to 20
for y=1 to 50
high portB.1
low portB.0
low portB.2
high portB.3
pauseus 1500
high portB.3
high portB.0
low portB.1
low portB.2
pauseus 1500
high portB.0
low portB.1
high portB.2
low portB.3
pauseus 1500
high portB.2
low portB.0
high portB.1
low portB.3
pauseus 1500
next y
next x
end
according to this program the motor will be running in TWO PHASE MODE. now the problem is this that we have to detect a white reflector tape line to a certain point using two LED-Phototransistor sensors. When both the sensors will signal high output the motor has to stop and move further. Now the thing is that how i should use this statement
if (portB.0=1) and (portB.1=1) then start
start:
some other routine to perform
I want to work in the way im writing below:
The robot should start running straight first. As soon as it detects the white reflector tape on both the sensor pins, it should go to some other routine and discontinued the previous one. and if it has not detect that yet than it should keep moving forward.
How i can put this If condition in the above coding.
I shall be thankful to u for ur quick and effective reply.
Regards
Take carez
Good Bye!