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.

need help in stepper motor program 8051

Status
Not open for further replies.

senthil17

New Member
i am doing my project in microcontroller 8051 to run motor as follows

i want to keep 4 buttons which are
BUTTON 1. UP

BUTTON 2. DOWN

BUTTON 3. REPEAT

BUTTON 4. RESET

if i press button 1(up) motor should run forward direction and then if pressed button 2(down) motor should run reverse direction.while i press
button 3(repeat) it must run the motor with memory of already rotated angle.while i press up and down.
i want the program for this.i wrote for forward and reverse in machine language dont know how to set for memory and all.please help me.if cant in 8051,tell me in some other microcontroller
 
i am doing my project in microcontroller 8051 to run motor as follows

i want to keep 4 buttons which are
BUTTON 1. UP

BUTTON 2. DOWN

BUTTON 3. REPEAT

BUTTON 4. RESET

if i press button 1(up) motor should run forward direction and then if pressed button 2(down) motor should run reverse direction.while i press
button 3(repeat) it must run the motor with memory of already rotated angle.while i press up and down.
i want the program for this.i wrote for forward and reverse in machine language dont know how to set for memory and all.please help me.if cant in 8051,tell me in some other microcontroller
I understand BUTTON 1 and BUTTON 2, but your description of BUTTON 3 is not understandable the way you wrote it.

The memory situation on an 8051 is pretty straightforward.
  1. Code Memory is up to 64K bytes. 8-bits wide, either internal to the chip or external to the chip at addresses 0x0000 to 0xFFFF.
  2. Internal Data Memory is 128 bytes, 8-bits wide at addresses 0x00 to 0x7F
  3. Indirect Internal Data Memory is 128 bytes, 8 bits wide, indirectly addressed at addresses 0x80 - 0xFF
  4. Internal Special Function Registers (SFRs) are directly addressed at addresses 0x80 to 0xFF
  5. External Data Memory is 64K, 8 bits wide, at address 0x0000 to 0xFFFF.
You need to consult your datasheet for specific variations. Some additional points.
  1. Code memory is accessed on an instruction fetch cycle and by the instruction "MOVC" using the control signals ALE (Address Latch Enable), and PSEN* (Program Store Enable *).
  2. There is no conflict in the use of internal addresses in the range 0x80 to 0xFF. If the access is direct it is an SFR. If the access is indirect it is RAM.
  3. Access to internal addresses 0x00 to 0x7F, either direct or indirect, is always to RAM.
  4. External Data Access happens ONLY with the MOVX instructions, using the control signals ALE (Address Latchg Enable), RD* (Read Strobe*), and WR* (Write Strobe*).
Is that all clear?
 
yes i can understand the additional points very well.actually while button1 is pressed motor will run to some steps forward.then while pressing button2 performs reverse action of motor,to the original state where it start.then button 3 is pressed tat time it perform both button 1 and 2 action continuously...
is it clear now what button3 does
 
yes i can understand the additional points very well.actually while button1 is pressed motor will run to some steps forward.then while pressing button2 performs reverse action of motor,to the original state where it start.then button 3 is pressed tat time it perform both button 1 and 2 action continuously...
is it clear now what button3 does
I think so. How about BUTTON 4, what is meant by RESET?

If each of the buttons is wired to a port pin and you have an array of samples taken at fixed time intervals then you can detect a change and you can insist on a number of identical samples to get rid of the switch bounce.

Let P2 be the the button samples and the array button[4] be the last four samples.
Code:
  if(SAMPLE_TIME_EXPIRED)
  {
    button[3] = button[2] ;
    button[2] = button[1] ;
    button [0] = P2 ;
    if((button[3] != button[2]) && 
       (button[2] == button[1]) && (button[1] == button[0]))
    {  // There is a new button in button[0] and it has been stable
       // for the last three samples
      ......
    }
  }
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top