You are on page 1of 17

INTERFACING OF MICROCONTROLLER 8051 WITH L293D MOTOR DRIVER IC

Presented by :Devasheesh Mangla 11513202809

ORGANISATION INTRODUCTION
DRDO was formed in 1958 from the amalgamation

of the then already functioning Technical Development Establishment (TDE) of the Indian Army and the Directorate of Technical Development & Production (DTDP) with the Defense Science Organization (DSO). DRDO at that time was a small organization with 10 establishments or laboratories. Over the years, it has grown multi-directionally in terms of the variety of subject disciplines, number of laboratories, achievements and stature.

Microcontrollers
A

microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Parallax Propeller , 8051, PIC, AVR, ARM are some of the controllers commonly used nowadays.

8051 Microcontroller
The Intel MCS-51 was the first 8051

C developed by Intel in 1980 for use in embedded systems. The 8051 architecture provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.) in a single package The success of the Intel 8051 spawned a number of clones which are collectively referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments.

Features of 8051 C
8-bit ALU, Accumulator and 8-bit Registers; hence it is an 8-bit

microcontroller 8-bit data bus It can access 8 bits of data in one operation 16-bit address bus It can access 216 memory locations 64 KB (65536 locations) each of RAM and ROM On-chip RAM 128 bytes (data memory) On-chip ROM 4 kByte (program memory) Four byte bi-directional input/output port UART (serial port) Two 16-bit Counter/timers Two-level interrupt priority 1 Microsecond instruction cycle with 12 MHz Crystal. Power saving mode (on some derivatives)

Pin Description

Basic Pins
PIN 9: PIN 9 is the reset pin

which is used reset the microcontrollers internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.) PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit.

Basic Pins (Cont.)


PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V, 500mA to function properly, although there are lower powered versions like the Atmel 2051

which is a scaled down version of the 8051 which runs on +3V. PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected. PIN 29 is called PSEN. This is "program store enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins.

Ports
There are 4 8-bit ports: P0, P1, P2

and P3. PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage. PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access.

Ports (Cont.)
PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory

access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-A15.

PORT P0 (pins 32 to 39) PORT P0

can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0-AD7.

Interfacing L239D IC
We give +5 volts to pins no.1,16, 9 of L293D IC and pins no.

31,40 of 8051 and to all the keys. We give +12 volts to pin no.8 of l293d IC. All Keys are connected to port no. 2 of 8051. Pins no.4,5,12,13 of l293d IC and 20 of 8051 are grounded. Port no.3 pins of 8051 are connected to pins of l293d resulting in interfacing of both the ICs. Both the DC motors are connected to the pins of l293d IC (motor driving IC) Movement of both the motors is under the control of keys which has to be pressed to do the functioning.

Circuit Diagram

OPERATIONAL FLOW CHART


If we press key 1, our motor 1 runs clockwise. If we press key 2, our motor 2 runs clockwise.

Now if we press key 3, no motor runs.


If we dont press any key then both motor runs in clockwise direction

CODE FLOW CHART


START
Press key 1 Press key 2 Press key 3 No key is pressed

Motor 1 will rotate in clockwise direction

Motor 2 will rotate in clockwise direction

No motor will rotate.

Both the motoor will rotate in clockwise direction

END

Source Code

JNB P2.0, LABELLEFT JNB P2.1,LABELRIGHT JNB P2.2,STOP SJMP STRAIGHT ACALL DELAY LABELLEFT: SETB P1.0 CLR P1.1 CLR P1.3 CLR P1.4 ACALL DELAY SJMP MAIN LABELRIGHT: SETB P1.3 CLR P1.4 CLR P1.1 CLR P1.0 ACALL DELAY

STRAIGHT: SETB P1.0 CLR P1.1 SETB P1.3 CLR P1.4 SJMP MAIN STOP: CLR P1.0 CLR P1.1 CLR P1.3 CLR P1.4 SJMP MAIN

CONCLUSION
The survey was carried out to find out the controlling

of DC motor by using microcontroller 8051.It is done by connecting 8051 with L293D IC which is a motor driving IC. APPLICATIONS
Industrial automated equipment carriers

Automated cars
Small scale models Endless source of ideas