Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

DC Motor with 8051 using L293D

Status
Not open for further replies.

nikzhafran

New Member
Untitled.png


I want to make control when press pushbutton p2.0 and pin p3.0 turn on when release pushbutton p2.0 it will stop ...

pushbutton p2.0 control motor p3.0
pushbutton p2.1 control motor p3.1
pushbutton p2.2 control motor p3.2
pushbutton p2.3 control motor p3.3

I have make a program but it only p3.0 on .......
Can anyone help me ?


Code:
          ORG 00H
        MOV A,00H
        MOV P2,A
        MOV P3,A

MAIN:   
        JB P2.0 , DPNKN
        ACALL DELAY
        SJMP MAIN


DPNKN:    CLR P3.1
        SETB P3.0
        ACALL DELAY
        CLR P3.1
        SJMP MAIN1

MAIN1:   
        JB P2.1 , DPNKN1
        ACALL DELAY
        SJMP MAIN


DPNKN1:    CLR P3.1
        SETB P3.1
        ACALL DELAY
        SJMP MAIN2

MAIN2:   
        JB P2.0 , DPNKN2
        ACALL DELAY
        SJMP MAIN


DPNKN2:    CLR P3.1
        SETB P3.0
        ACALL DELAY
        CLR P3.1
        SJMP MAIN3

MAIN3:   
        JB P2.1 , DPNKN3
        ACALL DELAY
        SJMP MAIN


DPNKN3:    CLR P3.1
        SETB P3.1
        ACALL DELAY
        SJMP MAIN

DELAY:     MOV R3,#250 
HERE2:     MOV R4,#250 
HERE:     DJNZ R4,HERE 
        DJNZ R3,HERE2
        RET
        END
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top