
He used the eXtreme Burner for burning the code. He has used the low cost 28 pin AVR Development Board and the USBasp AVR Programmer by eXtreme Electronics. The video is made by Lavin Khandelwal for ma圎mbedded. This is a simple demonstration of controlling two DC motors using a single L293D IC and a microcontroller. The code can also be found on pastebin and in the code gallery.Īfter burning the code into your MCU, you will find that the motors rotate in clockwise direction for 0.5s and counter-clockwise direction for 0.5s. If you are new to AVR Studio 5, you can read this post to get started with it.

Now open up AVR Studio 5, type the following code and build it. Assuming ATMEGA32, let us connect L293D across PORTC pins (PC0…PC3) as shown in the diagram below. Now let’s generate control signals from the AVR MCU and feed them to the inputs of L293D. Enabling both pins at the same time will drain your battery unnecessarily. Suppose if you need to control only one motor at a time, you need to enable that particular EN pin.


Pin 1 EN enables the motor M1 whereas pin 9 EN enables motor M2.

There are two enable (EN) pins, pin 1 and pin 9.2 /***************************** This program was produced by the CodeWizardAVR V Standard Automatic Program Generator Copyright Pavel Haiduc, HP InfoTech s.r.l.In this way, we can have bidirectional control over two motor.
