MicroController Pros Home Page My Account  Cart Contents  Checkout  

****Note: We no longer process and ship international orders. Only orders from USA and Canada are now accepted.****
You can place international orders for our products on E-Bay. Just copy the item's title description from our website and paste it into the search box on E-Bay and place your order there.

  Store » PCAM+ 8051 Tutorial 7 My Account  |  Cart Contents  |  Checkout   
Quick Find
 
Enter keywords to find the product you are looking for in the Quick Find field above

or use
Advanced Search
Categories
Accessory Boards->
8051->
ADI Blackfin
Arduino->
ARM->
Atmel AVR->
Cypress PSoC
Freescale->
FTDI->
Locktronics
Microchip PIC->
MIPS
Parallax->
Renesas
Silicon Labs
ST Microelectronics->
Texas Instruments->
Tibbo->
Books->
Displays->
E-Blocks->
EEPROM/EPROM/FLASH
Embedded Ethernet->
Embedded Software->
I/O Modules->
Parts & Components->
Pick & Place Tools
Programmable Logic (PLD)
Prototype PCBs->
Robotics
ROM/Flash Emulators
Test & Measurement->
Tutorial Software
Universal Programmers->
Wireless->
Information
Intro to Embedded Tools
Embedded News Digest
Useful Resources
Shipping & Returns
Warranty & Liability
Privacy Notice
Conditions of Use
Contact Us
PCAM+ 8051 Tutorial 7: L293D-Based DC Motor Driver

Back to PCAM+ page.


Back to Chapter 6

L293D DC Motor Driver Interface with 89S52

The L293D is mounted on the PCAM+ board and is ready to use with very few interface connections.

You can follow these steps to play with a DC Motor using your own microcontroller code. Note that while the motor driver IC is mounted on PCAM+, a DC Motor is not included with the kit. You will have to supply your own.

Start by making these connections:

  • Connect P2.0 to E1 pin of L293D section (Section 8) on PCAM+ Kit.
  • Connect P2.1 to I1 pin of L293D section on PCAM+ Kit.
  • Connect P2.2 to I2 pin of L293D section on PCAM+ Kit.
  • Connect VS pin from L293D section of PCAM+ Kit to a suitable voltage line e.g. 5V or 9V. For example, you can connect VS to the +5V pin located near the 7805 voltage regulator IC. See the mark of +5V near the two-pin male header on the extreme right-bottom corner of the PCAM+ board.
  • Connect GND pin from L293D section of the PCAM+ Kit to GND of the external supply (to which VS is connected above). If using the on-board 5V supply as suggested above, this can be skipped as there is no need for a common Ground connection.
  • Connect your hobby DC Motor pins to pins O1 & O2 of the L293D section on PCAM+.

Write the following code using 8051IDE, assemble it and download it to 89S52 on PCAM+ kit using HandyProgUSB programmer.

Main:
        SETB    P2.0               ; ENABLE L293D DRIVER

        ROTATE_LOOP:
        CLR     P2.1
        SETB    P2.2                ;01 COMBINATION WILL ROTATE MOTOR IN ONE DIRECTION
        LCALL   DELAY           ;LET THE MOTOR ROTATE IN ONE DIRECTION
        SETB    P2.1
        CLR     P2.2                ;10 COMBINATION WILL ROTATE MOTOR IN OTHER DIRECTION
        LCALL   DELAY         ;LET THE MOTOR ROTATE IN OTHER DIRECTION
        SJMP ROTATE_LOOP

DELAY:
        MOV R5,#200D
        LOOP1:
                MOV R6,#45D
        LOOP2:
                MOV R7,#100D
        DELAY_LOOP:
                DJNZ R7,$
                DJNZ R6,LOOP2
                DJNZ R5,LOOP1
RET

Proceed to Chapter 8


Back to PCAM+ page.

Shopping Cart more
0 items
What's New? more
Level Shifter Board, 1.8V/3.3V/5V, 2 Circuits, I2C or SMBus
Level Shifter Board, 1.8V/3.3V/5V, 2 Circuits, I2C or SMBus
US$10.00
Bestsellers
01. 2x5 (10-pin) 0.05" pitch IDC Connector Flat Ribbon Cable, 20cm
02. 2x5 (10-pin) 0.05" pitch IDC Connector Flat Ribbon Cable, 12cm
03. 5-pin Press-Fit Header Strip, Breakaway Pins, 2.54mm Pitch
04. Parallel to USB Adapter: Connect USB printer to LPT port
05. 2x10 (20-pin) 0.1" pitch IDC Connector Flat Ribbon Cable, 15cm
06. 8-pin Press-Fit Header Strip, Breakaway Pins, 2.54mm Pitch
07. USB Universal In-Circuit Programmer PIC AVR ARM MSP 8051 EEPROM
08. 2x5 (10-pin) 0.1" pitch IDC Connector Flat Ribbon Cable, 15cm
09. ARM JTAG Debugger & Programmer, parallel port
10. Power Supply 3-12V DC, U.S. plug, 6 connection tips
Reviews more
This is .8mm spacing, so be aware of that when ordering. ..
4 of 5 Stars!
  Tuesday 19 March, 2024   List of all our Products

Copyright © 2003-2017 MicroController Pros LLC
Powered by osCommerce