Steincollector

CP1H step and direction

10 posts in this topic

Hi, I'm pretty new to the Omron world - working with a CP1H-XA40 on a project using analog, thermocouples, PID and high-speed pulse outputs. Not doing TOO bad for my first outing - although figuring out how to enable decimal timers slowed me up... I've gotten most of the above figured out, but I'm struggling with the hgh speed outputs. I'm a little uncertain how to implement step and direction. I'm not sure what instruction to use and not sure how the instructions relate to the set-up dialog in PLC settings. If someone could point me in the right direction, that would be appreciated Regards, Steinie

Share this post


Link to post
Share on other sites
Section 5-3-7 "Pulse Output Procedures" of document "W450-E1-06 CP1H-CPU Operation" offers a pretty detailed explanation. Just remember that to utilize pulse and direction the PLC Settings must be configured correctly, transferred the PLC and THEN AND MOST IMPORTANTLY POWER DOWN AND POWER UP PLC FOR NEW SETTINGS TO TAKE EFFECT. This is the most common mistake that folks miss when using advanced function on these PLC's [interrupt, HSC, Pulse Train etc. etc.]. I am of course assuming you do HAVE theis manual!

Share this post


Link to post
Share on other sites
The first thing to note is that when doing pulse and direction, you should use the Outputs indicated below for the functions indicated below: In other words, if you are trying to command pulse output 0, use 100.00 for the pulse output and 100.02 as the direction. After that, it is a matter of understanding the commands. If would recommend the following: If you are simply trying to do a positioning command, use the PLS2 command. To establish a home position, use the origin command (ORG). If you are trying to make the servo run at a fixed speed until you tell it to stop (jogging) use the ACC command in continuous mode. For this discussion, I will talk about the PLS2 command. The PLS2 command allows you to specify the number of pulses, the starting frequency of the pulses, the target frequency of the pulses, the acceleration rate, the deceleration rate, direction and relative or absolute command. You can do all of this in one command, the somewhat challenging part (for a new Omron user) is understanding how the instruction accesses memory. Lets say our instruction looks like this: The manual lays out the instruction in the general terms shown below: So, in our case, #0 is the port specifier (labelled P in the manual. This is a generic description that can be replaced with the following options): If you wanted to specify pulse output 1, you could choose to put #1. The # by the way means constant BCD or HEX. I could just as easily have used &0 which is integer 0 since integer 0 is the same value as BCD or HEX 0. Next is the output mode setting (labelled M in the generic drawing). In our example, the setting of #0100 was used. Using the chart below, this value is defined: So, the #0100 means that you are using the Pulse / direction output format. The #0100 means that you are issuing a CW command. and the #0100 means that the command being issued is a relative (incremental) command (as opposed to an absolute command. I chose relative because an origin does not need to be established to issue this command). Next is the settings table (labelled S in the generic drawing). The S area is 6 consecutive words of data that contain the following information: In our example, I chose to use D0 as the beginning word of the S area. Data memory (D) is a perfect area for storing numerical values (as opposed to using it for bits). It is a bank of 32K of retentive 16 bit values. So, if we have chosen D0 as S, then: D0 = Acceleration rate (strange units here, units are pulses/s/4ms). So, if you want to accelerate at 1000 pulses/s^2, then you would enter an integer value of 4 (1000*0.004) in D0 . D1 = Deceleration rate (strange units here, units are pulses/s/4ms). So, if you want to decelerate at 1000 pulses/s^2, then you would enter an integer value of 4 (1000*0.004) in D1 . D2 and D3 as a double integer (32 bits) = Target frequency. This is the constant speed of your move (the top of the trapezoid). If the target frequency is 10000 pulses per second, then store 10000 as a DINT (double integer) here. D4 and D5 as a double integer (32 bits) = number of pulses. If you want to send 100,000 pulses out to the servo/stepper, enter 100,000 as a DINT (double integer) here. The last operand is the starting frequency (D10). This is a double integer and specifies the starting frequency for the acceleration as well as the ending frequency for deceleration. See below: This is used for a couple of reasons. Reason 1 is that some steppers have a minimum frequency at which you can start, so this is used in those cases. Reason 2 is to blend moves together. If you are already running at a speed and you issue a second command, you can start the second command at the same speed the original is running. That should get you started. You will have to read more yourself in the manual to get details on the ORG and ACC command. Also, you may at some point need the INI command. Check out the CP1H Operations manual for wiring and other info: https://www.omron247.com/Industrial-Automation/Store/OmronDocumentDownLoad?doc=http://www.omron247.com/doc/pdfcatal.nsf/3A94FE41432C32B7862570DD005E7AE1/$FILE/W450E106_0309.pdf&docType=Manual&docFamily=SYSMAC CP Series CP1H CPU Unit Operation Manual [Large file 20MB] and the programming manual for information on the pulse train commands in section 3-20: https://www.omron247.com/Industrial-Automation/Store/OmronDocumentDownLoad?doc=http://www.omron247.com/doc/pdfcatal.nsf/B19999C7DA700A7A862570DD005CCAB6/$FILE/M11W4511007.zip&docType=Manual&docFamily=SYSMAC CP Series CP1L and CP1H CPU Unit Programming Manual ZIP File 6MB

Share this post


Link to post
Share on other sites
By the way, the setup dialog in the Settings tab mostly relates to defining your origin, input switch setup (laid out in the Operations manual) and the move type (trapezoidal vs. S-Curve). You can read all about it in the manuals.

Share this post


Link to post
Share on other sites
Hi guys, I do have all the manuals. It may be due to my background -- I have little motion or drive experience experience in my background - more of a process control/HMI/SCADA guy - but I was not understanding what the manuals were telling me. My thanks to Michael for the excellent explanations, I think I can take it from here. Regards, Stienie

Share this post


Link to post
Share on other sites
Thank you Mike!! Awesome explanation!!

Share this post


Link to post
Share on other sites
Some clarifications and tips, in addition to Michael's post. There is no minimum frequency limit for steppers. The reason is to avoid mechanical resonances in the equipment at stepper low frequencies. Also, using minimum frequency reduces positioning time. Blending moves together is not a reason, because new positioning instruction execution always starts from the actual frequency of the port. And by the way, there is no way to retrieve the momentary actual frequency from the port. Here are some observations from my personal experience with CP1H. Until port origin is set, its PV reading will reset after every move stop. Such reset does not indicate being in origin. Writing any value to port PV defines its origin. Whatever value was written, the origin is in PV=0. Port PV cannot be written by INI #2 during output pulses being generated. With the origin set, relative positioning will not start, if the resulting absolute destination is out of over/underflow limits (-2147483648 to 2147483647, 8000000 to7FFFFFFF hex). Absolute motion target is limited to these limits by definition. On position over/underflow by continuous mode pulse train: - Pulse train continues. - PV is frozen on limit value. - Origin is canceled and No_Origin bit is set. "Clear PV" control bit cancels the port origin setting. PV becomes zero and "No Origin" bit activates. If a PLC output is subject to both high-speed and regular ladder instructions: - During active pulse train, an output control by PTO instructions has priority over control by regular ladder instructions, regardless of the instructions order in the program (not tested for interrupts). - The regular ladder logics is being performed continuously,the output state is being monitored and can be used as a contact in ladder, regardless of high-speed pulse train on this output. The result of regular ladder logics processing will apply to physical output after pulse train stop. Set PV INI #2 instruction will generate error if activated during pulse train and will be performed only after pulse train stop, if still active. This does not depend on the instructions order in the program. It is impossible to switch from independent to continuous mode during pulses being generated. Active continuous motion instruction has priority over simultaneous Immediate Stop INI#3 instruction, regardless of their order in program. Neither will set error flag because of the simultaneous execution. Immediate stop will be performed when the continuous motion instruction becomes inactive. If positioning target is redefined during active pulsetrain, the deceleration rate has priority. That is, if actual deceleration rate is not enough to stop in new closer target, it will be overrun with following return. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
I agree that resonsance is the issue with steppers, perhaps I stated it too simply. This is not nearly the issue that it used to be. But, it is useful for blending moves together. Just yesterday I was using this feature trying to create a "poor man's" circular interpolation. I was doing multiple absolute commands where the axis had to reach its commanded position before continuing on to the next move. If the starting frequency for the next move was 0 then the move was very jerky, but if I set the starting frequency of the next move to the target frequency of the current move, then the transition was much more smooth. I agree if you send a command and change the destination well before the deceleration point, then the starting frequency is not important.

Share this post


Link to post
Share on other sites
Also I thank Michael for his explanation. I have a CP1L-L20DT-D and did the following program to test but had no success. Could you tell me where I went wrong? Test PLS2.cxp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now