Author Topic: Stepper motor help please  (Read 6300 times)

babinda01

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
Stepper motor help please
« on: September 27, 2006, 02:48:47 AM »
Hi,
I have a stepper motor operation from a T100MD888.
I have the system working ok in a loop as per following example, but what I need to put in place now is limit switches at each end of the range of travel.  How can I implement this????

C$ = LOAD_EEP$(3)
D$ = LOAD_EEP$(4)
E$ = LOAD_EEP$(5)
F$ = LOAD_EEP$(6)

D = (VAL(D$)*16)
E = (VAL(E$)*850)

stepspeed 1,D,100  

while 1
delay 100
stepmoveabs 1,E,10
stepmoveabs 1,0,10
delay 100
IF testio(Stop) goto @10: ENDIF
endwhile

@10 stepstop 1

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Stepper motor help please
« Reply #1 on: September 27, 2006, 07:12:28 AM »
Note that you should not execute two STEPMOVE or STEPMOVEABS consecutively as the second STEPMOVE will have no effect while the stepper motor is in motion. So you should not put them in a while loop like what you did in your example. Once you have executed a STEPMOVE or STEPMOVEABS, the PLC operating system takes over the task of controlling the stepper motor and will set a relay at the end of the move, all done in the background. The custom function can exit or continue to the next statement without having to wait for it to complete. You can use the "end-of-move" relay defined in the STEPMOVE command to trigger another move to continue the motion.

You can use limit switches to execute another custom function and execute a STEPSTOP command
     L1
|---||-------{CusFn}
     L2    |
|---||----+

I suggest you study the stepper motor program example in the "Samples" folder. There is an "IndexTable.pc5" program there which can help you understand how to use these commands. You can simulate it on your PC so it is quite easy to see how to chain the moves together in a simple manner.
« Last Edit: September 27, 2006, 07:23:14 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS