Top Topics

74*245 Motor Driver

H-Bridge Driver

Simple PWM Gen.

Handy Method Measuring RPM

Measuring RPM via Photo reflector

Introduction to Robotic

DC, Stepper,and Servo Motor

Related Link

Microcontroller Tutorial

Computer Interface
Tutorial

.............more links

 

 

 

BACK

void getHomeFromRoom1(void), void getHomeFromRoom2(void), void getHomeFromRoom3(void), void getHomeFromRoom4(void)
These functions maneuver the robot from the position it deploys the cup back to the home area using the line sensors and the encoder. Each is called only once by cupPlacement. Each getHomeFromRoom function is fundamentally identical to its corresponding room function. The only difference is that at the beginning of this function, the car is still located inside the room the candle is in. Subsequently, this function backs the robot up until the white line in the doorway is detected. After this, the robot continues to move in reverse a specified distance to get itself into a better position to make a 90 degree turn to orient itself parallel with the white line in the hallway. It then makes the aforementioned 90 degree turn (either right or left depending on the room it traveled to) and commences following the line in the manner the functions room1, room2, room3, and room4 do. Finally, once this distance is achieved, the motors are turned off and the code enters a forever loop (this is because there is no no-op instruction on the 89c51RD2) and no further instructions execute. One important fact we would like to mention is that the official rules for the IEEE hardware competition state that the robot is considered to be in the home area as long as some part of it has crossed over the tape enclosing the home area. As a result, there is a large margin for error on the trip back to the home area, the robot can stop short or go past the home area as long as some portion is inside the tape enclosing the home area.

 

Watchdog Timer

If the encoder interrupt does not occur in approximately 13 seconds, the watchdog timer backs the robot up slightly and makes a right or left turn. The direction of this turns alternates and gets increasingly larger each time the interrupt occurs. This keeps the robot from getting trapped against the wall for more than about 13 seconds and gets it into a better position complete the run.

void SetMotor(unsigned char, int) and void AllStop(void ) These two functions are used to control the speed and the rotation direction of the two DC motors. SetMotor sets up the Pulse Width Modulation in the PCA. It initializes the PCA and by accepting the unsigned char value between 0 and 255 it sets up the length of the time interval of the pulse sent to the DC motors. This determines the speed of the motor. AllStop simply sends zeros to both of the motors, which does not send any pulses to the motors. This stops their rotation.

BACK