

P1=0x02 sends 00000010 making Pin#1 high and others low. P1=0x01 sends 00000001 making Pin#0 of Port-1 high and all others low. The statement is making all the Port-1 eight pins low or it is initializing the Port-1 as output. P1=0x00 is sending eight bit value to the Port-1 in hexadecimal its binary equivalent is 00000000. In the main function I use the Port-1, Pin# 0 and 1 for my logic. The delay function is used to give some time to motor to run in a particular direction for some time.
L293D MOTOR DRIVER CIRCUIT DIAGRAM WIKIPEDIA CODE
I am using keil ide to write and compile my code for the 8051 microcontroller. The code is also very simple it is same like making an led blink. Only a single chip can perform an H-bridge functionality. Its small in size, no extra components are required with it. L293d contains an H-bridge circuit in it. L293D motor driver IC is a replacement of H-bridge circuit and i am going to use it in the project. Making an H-bridge circuit makes a lots of mess on bread board. H-bridge circuit can be made by using four transistors or mosfets. I am going to power, rotate and change the direction of motor by utilizing the second method. One more advantage of using H-bridge is, we can change the polarity of the current by changing the input logic, this property of the h-bridge make’s our motor to run in both forward(clockwise) as well as backward(anti clockwise) direction. One another method is to use an h-bridge circuit that can provide much greater amount of current and can be used to control the direction of motors(Dc, stepper, servo). One method is using a transistor or mosfet at output and instead of powering the motor directly from microcontroller pin, power it with an external source connected to collector of transistor or source of mosfet.
