Sign in to follow this  
Followers 0
ucdwino

Help with PLS2(887)

24 posts in this topic

Hi guys, I am scratching my head here - and I suspect Im missing something basic. For the record, I'm a business owner who builds his own production machinery - not a trained automation engineer - and while I'm pretty smart, I also accept that I'm a noob and am probably making a really basic mistake. I am using a Omron CP1L-L with 14 points on a pretty simple machine that laser engraves wine closures. Everything is working perfectly except the stepper motor I have a gecko stepper motor drive http://www.geckodrive.com/geckodrive-step-motor-drives/g203v.html wired to the outputs of the PLC. Output 00 goes to the STEP terminal, Output 01 goes do the DIR terminal. The common runs through the power supply (though I jumped the connection to the two COM connections) This is what I understand from the manual to be the wiring for pulse output #0 for my PLC model. If I write a ladder program that sets the state of the pins directly, I can get it to send a step pulse when I hit a button, and change the direction of those single pulses when I throw a switch. - So I'm pretty sure I have the drive wired correctly, and the motor works. (I have the prototype of this machine working with the same stepper drive and an arduino - so I'm pretty confident in the hardware part.) Here is a screenshot of a test program in run mode while I am holding down the button that is supposed to activate this function. The settings for the function in the D memory area took me some time to make sense of, so I'm suspicious that I have something entered wrong there. I have that window open too so you can see them. This is my first time with a "Real" automation platform. I have built a few machines using arduinos and programmed them with text. - but I wanted a more robust and industrial control system for this version of the machine so I am in uncharted territory here. Thanks in advance for your help. I really appreciate it, and I have to say, I have learned a lot on this forum already by reading the other posts and responses. Thanks again, Tim

Share this post


Link to post
Share on other sites
I do not see anything wrong with the values you have chosen. Here they are shown in decimal format. You can do this by creating symbols then inputting them into the watch window. It may make troubleshooting easier. The only thing I see in your screen shot is the PLC is in PROGRAM mode. Not sure if you did that temporarily or if you were trying to execute the program like that but the PLC will need to be in RUN mode. I'll have a CP1L to test with in a few hours. I'll post back if no one else does.

Share this post


Link to post
Share on other sites
It's unclear what is the problem, but You are executing a relative positioning instruction in non-differential format. Such positioning will never stop as long as the rung condition is true, because the positioning restarts in every scan. Use @PLS2 differential format, or absolute positioning. I would also start testing with smoother acceleration/deceleration, in order to exclude the stepper stall from the possible problems. The acceleration/deceleration rate units are Hz/4msec, so your actual acceleration is 125kHz/sec. If the positioning does not start, the problem is not in the shown rung. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
That program was just to try to keep things simple - eliminate other errors in the larger program and just trying to get the stepper moving. Perhaps taking it out of context isnt helpful however. Here is a screenshot of the auto-run cycle of the program. I tried to comment everything, but let me describe the function of the machine. This machine laser engraves the top of wine closures. The caps are fed in by gravity and a indexing wheel, driven by the stepper motor in question, grabs them and moves them into position so that the laser mark is centered. There is a manual / auto mode switch (RAS) which switches between positioning mode and auto-run mode. There is a cycle start button (STB) with a latching instruction that will then keep the machine going so long as there are caps available to process. The intent is that the machine will do nothing if there is no cap in the chamber, as detected by a proximity sensor P1, but if there is a cap in the pre-chamber as detected by another sensor P2, it will advance 250 steps to put the cap in position. That is the lower part of the OR conditions for invoking the PULS2 instruction When there is a cap in the chamber, it will send a signal to the laser controller to fire the laser. (FIR) That signal will persist until the laser responds with a signal that it is busy (LBS) The machine needs to not engrave the same cap twice, so I put in a SET function as a flag that the cap in the machine is marked, as soon as the laser says it's busy (has started the mark) When the laser busy signal (LBS) goes back to off, I want the cap ejected - so that is the upper part of the OR conditions for triggering the PULS2 instruction. Either way, if the PULS2 function is called, the flag is RSET to indicate that a new unmarked cap is in the chamber. I sincerely appreciate the help guys. Though I'm new here, I participate in a few other forums trying to help people with my hobby (multi-rotor helicopters) and I have found that if just a couple of suggestions doesn't solve the problems - then it is likely the guy isn't going to get a solution. If that is the case here, I would be interested in paying someone to consult on helping me get this set up properly. Please let me know if you are interested in that since I'm at the point where I'm pretty sure a couple of hours from someone who actually knows what they are doing will replace many many more hours of me banging my head against the wall. Again, thank you. -Tim

Share this post


Link to post
Share on other sites
You still did not describe what is the problem with the PLS2 execution. Does the motion start or not? Neither did you fix the obvious mistake I told you about. And why don't you switch the data monitor to decimal? Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Hmm.. I thought you were talking about how in that sample code, it was a "im holding down the button" instead of a run mode state. If that wasnt it, then I dont understand what you meant about differentiated. I might need a more plain-english description of the error. The motion however does not start at all when I invoke the PLS2. I can get it to work if I have an alternate program which merely says "set step output high when I hit this button) - the motor will move then. So the electrical connection works. It is just the instructions for pulse outputs. For the record I also tried PULSE and ACC combinations to similarly failed effects. When the ladders light up green in run mode or when I step trough it in simulation, the PLS2 function does not also light up green - if that indicates anything. Thanks.

Share this post


Link to post
Share on other sites
Instructions are not being monitored green when executing. Few hints, in the order I would verify. If the PLS2 instruction parameters on the last screenshot start from D0, the frequency D2=#C80000 exceeds 13MHz, while the limit is 100kHz. Remember, frequency and target are double words. Ensure there are no other instructions affecting this port, below in the program. Monitor the output 100.00 LED and A276 double word when you believe the port#0 should generate pulsetrain. If the A276 value is changing, the pulsetrain is being generated, and the motor must rotate. Program a coil in parallel to the PLS2 instruction, to ensure that the rung condition is true when you monitor it as such. If the rung condition is true, program a branch parallel to the instruction (immediately under it), with a coil driven by P_Er contact. The coil active will indicate the instruction execution error, most probably parameter(s) out of range. "I can get it to work if I have an alternate program which merely says "set step output high when I hit this button) - the motor will move then." Clarify this statement. The stepper should execute only a single step every time the output 100.00 is altered. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Correct. It takes one step each time I hit the button when I do that. Obviously, hitting the button 250 times isnt practical, but the point is, when I just set the outputs outside of a pulsetrain instruction, the stepper operates just as it should... (which means it not the hardware) So somehow my instruction is just not telling the pulse output to do it's thing... Thanks for your help. I really do appreciate it! -Tim

Share this post


Link to post
Share on other sites
I was wrong about the frequency. Your values are correct. Ensure in the PLC Settings/Pulse Output 0, that Undefined Origin is Undefined, Limit Input Signal Operation is Search Only, and be sure to uncheck Use define origin operation. Changes, if any, must be done offline, downloaded to the PLC, and its power must be cycled for the new settings to become active. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
This will also be great information to know if your PLS2 instruction is failing or the problem lies elsewhere. Input a new contact then type in the drop down box "P_", then click on the drop down box and select "P_ER". The predefined instructions are case sensitive. You may notice in the snap shot below I've done the same thing myself. It automatically generates a useless Tag associated with N/A (nothing). Have it set an unused output just for troubleshooting purposes. If during operation your output is set then you'll know there is something wrong with instruction. You can right click on the output and select Set > OFF to try again. Edited by IO_Rack

Share this post


Link to post
Share on other sites
Here are some basic diagnostics that will point you in the right direction. 1. Add the P_ER code as IO_Rack suggested. This is always a good starting point to see if the instruction generates an error. 2. Make certain that you have downloaded the code. In the haste of testing, we sometimes forget to download the code to the PLC. 3. Look at the output LEDs on the PLC. Are they turning on, or simply remaining dark? 4. Can you post a copy of your code? There may be something else that we can't see from the pictures. If you can, I can load it into a CP1L and test it.

Share this post


Link to post
Share on other sites
This is a very good point.This is why I always activate the "Prohibit the online operations until the PC and PLC data matches", in the CX-Programmer Tools/Options/PLCs. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Thanks for the help. I have done all of that, and still no dice. I'm starting to wonder if there is something wrong with my unit. Regardless, Insead of the gecko stepper driver, I have ordered a omron Servo and driver so that I can eliminate any further hardware problem possibilities and I can hopefully use sample programs they have to base my design off of. That's an unwanted thousand dollar upgrade, but thems the breaks. Again, thanks for the help, I sincerely appreciate it. I'll post back once I get the servo installed (and hopefully going)

Share this post


Link to post
Share on other sites
You never posted entire project, as suggested. And a stupid question: is your PLC a transistor output unit?

Share this post


Link to post
Share on other sites
1) Ok, I have done the P_ER thing. It doesnt trip when I run the code. 2) Yes, I have uploaded the code to the PLC and Power cycled it after the transfer. I have forgotten that in the past, but not every time... 3) Nothing is lighting up on the Output LED's on the pulse ports when I do this. I do get a lit Up LED for the output to fire the laser, and for testing I have that output tied to an external LED, and that also lights up appropriately. This IS a transistor output PLC and those outputs use the same power source as the pulse outs - so all of that is working. 4) I have attatched my code here. Thanks for your help looking at it. While you have it open, I have a feeling I have done a really rookie job setting up the counter. When I simulate the program or put it in run mode and fake the laser responses with a button, I see the "Cap Marked" flag toggle on and off like it is supposed to, but the value of the counter doesnt change... I continue to appreciate the help. As I said before, I have ordered an Omron Servo and Drive which should be here Friday, so if this is a hardware thing, that should resolve any questions there... Once I get the motor moving, the counter working fine, I have to do a jog mode to get the servo into it's initial position... Then this baby is off to the races.. just in time for a million unit order we are processing on the 21st and running 2 shifts a day for a week to get done! Laser Engraver Mk2.cxp

Share this post


Link to post
Share on other sites
I've downloaded your program and tested it on a CP1H. Again similar PLC. The LED's on the pulse output terminals come on briefly as expected. I'm afraid that a new servo/stepper will not solve the issue that your LED's are not coming on. When you execute the PLS2 instruction with the data values set as you've shown previously, then the LED's should light without anything connected to the outputs. We'll see if PMCR can see something I've missed. He mentioned having a CP1L to test with. Where are you located?

Share this post


Link to post
Share on other sites
You upper OR circuit triggering the @PLS2 will never be TRUE. Before we resolve that you should replace all those contacts with a single push button just for testing. We need to get your pulse output LEDs to come on.

Share this post


Link to post
Share on other sites
Ok thanks. I will switch my button which I use to spoof the laser busy signal to trigger the PLS2 Command. (its closer to the PLC than the machine controls which I cant press AND watch the LED's at the same time) Is it possible that I have a defective PLC? - And I'm in Napa CA.

Share this post


Link to post
Share on other sites
Ok - I have just done a single input button to call the @PLS2 Function. I also input the P_ER contact to switch on output 1000.05 which drives my external LED. The output lights do not come on with a button Press. I have tried it with Pulse port 0 and 1 both. After that, I tried just setting those outputs to true with the press of the same button, and that works for lighting up those outputs, and, in fact when I hit the button to trigger the output to my step pin which is on 100.00, the stepper motor does advance one step each time I hit the button. So hopefully that means that the problem is in getting my PLC to actually use the pulse output... - and not anything with hardware or wiring etc...

Share this post


Link to post
Share on other sites
Couple questions about your program. Why the startup mode in the PLC settings is not Monitor? The data table contains correct data, but has this ever been downloaded into the controller? The screenshot in your earlier post is the offline one, not the monitor. Also, be aware that D10 must be a double integer, so the D11 must be 0. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Ok, I have changed the startup mode to monitor. Is that a general safety thing, or something that impacts this? I was hopeful that the lack of the second word in D10 was the problem... but that didnt change anything. As for downloading, I have been using the "Transfer to PLC" button and then hitting the "transfer all" button when the transfer dialog appears. Is that not enough? In addition, I also further verified that the driver does work, I used this alternating code To send pulses to the drive at the CPU's clock speed, and it turns as it should! ( I was really happy to see that by the way ) But... then going back to the simple pulse command I get nothing again... no lights on the outputs, no motion. I feel like we are eliminating a lot of things though... Thanks again for the help!

Share this post


Link to post
Share on other sites
HOLY CRAP! I just found the "transfer to PLC" button in the memory window! I transferred, power cycled, and it WORKS! YEEE HAW! Now I dont know if I should feel happy because it's working, or stupid because I had just assumed that "transfer all" included the transfer of memory settings... Thank you so much guys. And thanks for having patience with helping out a total noobcake. Now to actually get the whole program working as intended! - ill probably be back with some more questions. Thanks again!

Share this post


Link to post
Share on other sites
Great observation Sergei! Congratulations ucdwino! No need to feel stupid. Some Brands PLCs do and some don't. When setting up data memory in Omron PLCs, I generally do this in hard code unless the data needs to be dynamic. See the attached screen shot. The P_First_Cycle is a system bit that will become TRUE for one PLC execution scan upon power up. Notice the difference between the MOV (Transferring your INT values) and MOVL (Transferring your DINT & UDINT values). Good luck with your testing and feel free to ask more questions. You may want to start a new thread, as this one is getting fairly long. Edited by IO_Rack

Share this post


Link to post
Share on other sites
Glad to hear it's working now. But do not abuse power cycling. This time it was not necessary. In fact, it's necessary only after the PLC setting changes download. Edited by Sergei Troizky

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
Sign in to follow this  
Followers 0