EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / In what form signal is given to AT89c51 mc’s input

In what form signal is given to AT89c51 mc’s input

|

Microcontroller › 8051 › In what form signal is given to AT89c51 mc’s input

  • This topic has 8 replies, 2 voices, and was last updated 10 years, 1 month ago by nitish kumar singh.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • April 3, 2015 at 12:09 pm #3601
    nitish kumar singh
    Participant

    I had feed following program into AT89C51 mc . And for testing i am just connecting +ve terminal into P1^0 but nothing was happening to stepper  motor.

    #include<reg51.h>
    void MSDelay (unsigned int value);
    sbit sense1=P1^0;
    sbit sense2=P1^1;
    void main ()
    {
    int i;
    P1=0xf0;
    while (1)
    {
    if (sense1==1 && sense2!=1)
    {
    for (i=0;i<=2;i++)
    {
    P2=0x66;
    MSDelay (350);
    P2=0xCC;
    MSDelay (350);
    P2=0x99;
    MSDelay (350);
    P2=0x33;
    MSDelay (350);
    }
    }
    sense1=0;
    if (sense2==1 && sense1!=1)
    {
    for (i=0; i<=2;i++)
    {
    P2=0x66;
    MSDelay (350);
    P2=0x33;
    MSDelay (350);
    P2=0x99;
    MSDelay (350);
    P2=0xCC;
    MSDelay (350);
    }
    }
    sense2=0;
    }
    }
    void MSDelay (unsigned int value)
    {
    unsigned int x,y;
    for(x=0; x<1275;x++)
    for(y=0;y<value;y++);
    }

    April 3, 2015 at 6:57 pm #12747
    Ashutosh Bhatt
    Participant

    it should not be 

    if (sense2==1 && sense1!=1)

    but

    if ((sense2=='1') && (sense1!='1'))

    also these two pins must be configured as input by

    P1 = 0x03;

    April 4, 2015 at 11:11 am #12759
    nitish kumar singh
    Participant

    in both If condition, it is required to correct it or only in one case.

    if ((sense2=='1') && (sense1!='1'))

    if ((sense1=='1') && (sense2!='1'))

     

    After making correction the led on ULN 2003 blink randomly but stepper motor yet not rotating.

    April 4, 2015 at 11:15 am #12760
    nitish kumar singh
    Participant

    The above program is correct to rotate in clock wise and anticlockwise.I wantt to rotate only two step in each direction according to condtion not to rotate continously.

    April 5, 2015 at 10:14 am #12765
    nitish kumar singh
    Participant

    please reply sir

     

    April 6, 2015 at 11:54 am #12768
    Ashutosh Bhatt
    Participant

    which type of motor u have

    unipolar or bipolar?

    for unipolar u can use ULN2003A chip

    but for bipolar u have to use L293D chip

    the pulse sequence you are giving is for bipolar motor 

    for unipolar motor it will be 0x01,0x02,0x04,0x08…..

    April 6, 2015 at 3:52 pm #12772
    nitish kumar singh
    Participant

    sir

    i had purchased a stepper motor in which uln2003A was provided along with it.so it may be unipolar motor.

     

    April 7, 2015 at 4:04 am #12774
    nitish kumar singh
    Participant

    following program is correct for rotating the stepper motor half revolution in clock wise and anti-clock wise.?

    My aim is to use this stepper motor to close and open the Railway crossing gate..

    #include<reg51.h>
    void MSDelay (unsigned int value);
    sbit sense1=P1^0;
    sbit sense2=P1^1;
    void main ()
    {
    int i;
    P1=0x03;
    {
    if ((sense1=='1')&& (sense2!='1'))
    {
    for (i=0;i<=2;i++)
    {
    P2=0x01;
    MSDelay (10);
    P2=0x02;
    MSDelay (10);
    P2=0x04;
    MSDelay (10);
    P2=0x08;
    MSDelay (10);
    }
    }
    sense1=0;
    if ((sense2=='1') && (sense1!='1'))
    {
    for (i=0; i<=2;i++)
    {
    P2=0x01;
    MSDelay (10);
    P2=0x08;
    MSDelay (10);
    P2=0x04;
    MSDelay (10);
    P2=0x02;
    MSDelay (10);
    }
    }
    sense2=0;
    }
    }
    void MSDelay (unsigned int value)
    {
    unsigned int x,y;
    for(x=0; x<1275;x++)
    for(y=0;y<value;y++);
    }

    April 8, 2015 at 7:09 am #12775
    nitish kumar singh
    Participant

    reply sir?

    If you have such program that is used to control the Gate then please sent it to my mail id [email protected]

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • LED circuit for 1/6 scale diorama May 15, 2025
  • stud mount Schottky diodes May 15, 2025
  • Hi Guys May 15, 2025
  • using a RTC in SF basic May 14, 2025
  • Can I use this charger in every country? May 14, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise