bmw68 (Customer) asked a question.

Beginner in need of help with a simple pulsing program - Click PLC

Beginner here, working on a Click PLC. I'm trying to run a linear actuator with a pulse operated stepper motor (TB6600). I have the pulse operated driver working using a timer program to turn one of my Y ports on/off at 1ms intervals (seems like I'm only getting 200 steps per 3 sec, however, not a big deal though). I also have 2 NO/NC limit switches.

 

 

What I would like to accomplish is to turn the PLC on and have it check for/go to home at one switch, wait 10 sec, then run to the other switch, wait 10 sec, then return home.

 

The direction of the motor is operated by one of the other Y ports. It requires constant Voltage to run the motor in the direction away from home.

 

First off, is this feasible on the Click system? And secondly, how would I go about setting up this logic? (still don't fully grasp ladder logic)

 

Any help would be greatly appreciated.


  • Tinker (Customer)

    You write: "using a timer program to turn one of my Y ports on/off at 1ms intervals (seems like I'm only getting 200 steps per 3 sec, however, not a big deal though)."

    Are you using a timed interrupt for that 1mS? are you using "immediate mode" on the outputs (which I imagine are likely SET and RESET)? if not using immediate more you are going to get weird interaction between when the interrupt routine set a bit in the "shadow register" and when the PLC scan turns on the hardware output, with a 1mS interrupts it is quite possible to both "turn on" and then "turn off" before the hardware changes state at all.

    200 steps in 3 seconds is an order of magnitude slower than the 1mS you were aiming for so that seems like a problem, even if you can live with slower, I'd want to know why things are not working the way you expect.

    If you are OK with the slow speed you might just put you stepping in the regular scan which can be a couple of milliseconds with a short CLICK program (200 steps in 3 seconds is 15 milliseconds per step)

     

    I guess if you can live with the slow speed then I guess it is "feasible" with a CLICK, but I would recommend a Do-More if your budget can handle it, though if you are using a $12 driver one might guess that your budget is limited.

    Expand Post
  • Tinker (Customer)

    I don't understand how that works at all. While a short CLICK program may have a scan time of not much more than a millisecond, I don't know that it is ever a whole lot less than a millisecond.

    At best, I don't think this can switch any faster than double the scan time so I don't see where a 1 millisecond timer does anything very useful.

     

    The fact that you say the actual rate is "seems like I'm only getting 200 steps per 3 sec" suggests something weird is going on, though you do have a microstepping driver, if you have it set for say, 8 micro steps, and CLICK is putting out about 500Hz or so (switching every other scan with a scan time of about 1mS) then that could make sense.

     

    Also, timer registers are integers, comparing to a float does not seem very efficient, if it is greater than or equal to 0.5 it will also be greater than or equal to 1.

     

     

    I don't have a CLICK handy at the moment so I haven't tested this, but attached might be a possible way to do what you want

    Expand Post
  • David_H (Customer)

    I agree with Tinker, you're not going to get that kind of timing resolution with a click.

     

    At best, you could use a 1 ms interrupt to trigger a toggle on/off interrupt routine.

     

    Be sure to set your y set and reset coils to instantaneous.

     

    In your main program, you can set DS1 to the number of pulses you want to move, and reset the counter to initiate a move.

     

    If you want to change the timing of the pulses in the program, you'll have to play with adding a counter in the interrupt program to return before it toggles you're output.InteruptSetup_LIInterupt_LI

    Expand Post