Author Topic: Jog Moves with Step / Dir  (Read 1962 times)

Mark P.

  • Newbie
  • Posts: 6
    • View Profile
Jog Moves with Step / Dir
« on: March 08, 2019, 01:16:38 PM »

I have an application that uses Step and Direction on the FX processor.

All works great, but I need something a bit different than the standard commands ?

Let say my stepper motor is running a fan.    It really has no distance

I just want to run it and adjust the speed while in motion.

Basically a jog command with speed change.

My concern is all the move Commands seem to have a distance associated with them.

I don't want the fan to stop eventually when it reaches the upper limit of move commands, just turn.

Is there a way to directly control the pulse train out ?

Thank you for any thoughts



  • Expert Member
  • Posts: 470
  • Old PLC Coder
    • View Profile
Re:Jog Moves with Step / Dir
« Reply #1 on: March 08, 2019, 07:36:19 PM »

The PLC supports some number of PWM (pulse width modulation) channels. You could use one of these channels as the source of pulses for your stepper driven fan.  You can control the pulse (step rate) via the SetPWM statement in TBASIC.

SetPWM allows you to control the pulse rate and the duty cycle. For your application you need only 2 duty cycles, 50% and 0%.  The 0% value stops the pulses.

I have used the PWM mechanism to control fan speed.  My customer used a DC fan that accepted a PWM signal to control fan RPM.

Stepper motors are not, typically, used for fans for a lot of good reasons.

Fans used to cool CPU chips and mother boards are variable speed.  The fans with 4 wires use a 0..5 VDC PWM signal to control fab speed. These fans are cheap and plentiful.  

The PLC's PWM system will work with the 4 wire fans if you limit the signal to 0..5 V.

Best regards,

Gary D*ckinson
« Last Edit: March 09, 2019, 01:53:58 PM by garysdickinson »


  • Expert Member
  • Posts: 470
  • Old PLC Coder
    • View Profile
Re:Jog Moves with Step / Dir
« Reply #2 on: March 11, 2019, 06:51:29 PM »
Mark the number of steps before the stepper quits moving is about 2 billion.

If the step rate was 800 pulse/sec with the maximum step count your fan would run for about 31 days before it stops.

What is the expected max time that the fan needs to run? 1 day, 1 week or one month?  2 billion steps will handle it.

If your max run time is measured in minutes or hours, just program it for the max step count of &h7ffffff every time you run the fan.

If you are looking for variable speed to meet your air flow requirements, then the use of steppers system is not ideal.  I think that you will have to abort the current stepmove command and physically stop the stepper before changing the speed. This may be audibly annoying.

Gary D
« Last Edit: March 11, 2019, 07:39:17 PM by garysdickinson »


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3122
    • View Profile
    • Internet Programmable PLCs
Re:Jog Moves with Step / Dir
« Reply #3 on: March 12, 2019, 09:55:22 AM »
Gary's suggestion is what we would normally advise users too.

The good news is that since firmware version r70 (on FMD and Nano-10) and on all the Fx series since firware version F90.0 we have implemented stepjog function which is to STEPMOVE with either &H7fffffff or &H80000001 for infinite rotation in positve or negative directions, respectively.

Hopefully this answers to your question. This should have been included in the manual. Will bring this up with the staff who maintain the manuals to include in future editions.

« Last Edit: March 12, 2019, 11:00:33 AM by support »
Tel: 1-877-TRI-PLCS