Jump to content

Recommended Posts

Posted (edited)
Hi there! I am in a bit of a cinch where I have inherited a project that uses a CP1L PLC to control a stepper motor that drives a belt to 3 specific positions on a rail. This project was abandoned halfway through by the original programmer and Management figured that since I have programming experience I would have no problem completing this project..... Well. I do have programming experience (C, java and so on) but have only tinkered a bit with PLC logic and ladder programming. I can do simple things with CX-programmer, but I am completely selfthought and I fear that I am not doing things the way they should be... Hopefully there is a simple solution to this so if someone could point me in the right direction I would love to learn how to do this. Ok. the system so far: I have a CP1L with transistor outputs and a stepper driver (and motor) already wired up and sort-of working. I have the outputs configured and is able to drive the stepper motor in both directions using pushbutton inputs.I am using the SPED instrucitons for this and the motor will happily move as long as I hold the button. So I assume I have configured the PLC and the wired the driver/motor correctly. However the automation in this project calls for 3 distinct position on this rail. The positions are not known beforehand and needs to be configured during operation. So in my mind I would like to define a specific position as 0, and I have installed a sensor here that also acts as a end limit switch for the motor movement. I would then like to "jog" the load carrier to pos1, enter that number of steps into memory, jog to next position and do the same and so on. So for example pos1 would be 1500 steps from 0 , pos2 3000 steps from 0 and pos3 6000 steps from 0 Then I would like to recall pos1 for example and have some logic decide the direction and number of steps necessery to reach that position from the current position. So if the carrier was halfway between pos2 and 3 (approximately 4500 steps from 0) and recall_pos1 was activated I would need to step 3000 steps ccw to reach pos1. The problem with my program so far is that basically I do not know what I am doing... So I am trying different commands and reading the manuals without really understanding them. I can get memory locations to update with the current position at the push of a button and I can jog the position manually both cw and ccw. The end position sensors also work in that I cannot jog outside the end limits. But the problem is that I am loosing the current number of steps from 0 after the first command so my logic is failing. Meaning that by every push of the jog button the counter is reset at the current position so I am loosing my reference point in position 0 So my first question is: Is what I am trying to accomplish possible with the equipment that I have? question 2: If the answer to question 1 is yes then: What is the best way to ensure the number of steps from 0 is preserved between the different commands? I have used SPED in this screenshot but I have also experienced with PLS2 without complete success... The store/recall function is made like this: Making sure only on the of the 3 buttons are activated. Ladder instruction for Function block for Pos1 "Lampe1" = indicator light for pos1 FB: Trying to bypass the problem of resetting the current position everytime a new command is given. But I feel I am barking up the wrong tree here. There must be a better way to do this: Any suggestions would would be very much appreciated. I am I totally in the woods or is there hope? Edited by Stian

Posted
question 1: Yes, the CP1L can do what you want to do. It can handle two or four drives depending on the model. question 2: Store the target positions in separate D registers (DINT - two words) for each of the 3 positions using PRV(881) to capture the position. I suggest you use the PLS2 instruction for programmed moves. You will have to calculate the difference between the current position (read with PRV) and the target position (D register) for each move to get the distance for the PLS2 instruction.
Posted
The CP1L can have up to 2 pulse outputs. The pulse output present values (with respect to established origin) are contained in the following addresses an are in double integer (DINT) format: Pulse output 0 - A276 Pulse output 1 - A278 There is no need to use the PRV instruction in this case. You can simply use a MOVL instruction from the addresses above into the Data Memory address of your choice. The PLS2 instruction is a good suggestion for a command for the move (once you have taught the positions).
Posted
Hi. Thank you for your swift reply! Thank you for your suggestions. My problem with my earlier attempts was that the current position was reset everytime a new movement command was given. Will PRV read the pulse output and accumulate over several movement commands? Do you have an example on how to do setup PRV to read from the pulsetrain output? I think I will be able to solve the arithmetic to find "next movement" based on current position so long as the current position is a stable source so I am guessing P = 0 (Pulse Output 0), C = 0 (Reads the PV), and D=D10 would cause D10 to be populated with the current pulsenumber regardless of movement commands CW or CCW? Adding and substracting as the pulses are added in one or the other direction? If so that is indeed the solution to my problem. If you see some fubared assumptions on my part please feel free to point them out
Posted (edited)
I have tried this approach. But I had a problem with the next movement command resetting my 0 position. So trying to bypass this I did some memory moves and some arithmetic with the memory positions (adding and substracting accordingly) before and after the movement. But It felt like a very cumbersome approach. But I did use SPED for this instead of PLS2 so maybe this was my main issue?. My inital setting of the 3 positions must be set "manually" by jogging the belt carrier to its position and storing that position into memory. How would you use PLS2 to achieve a JOG function (=move motor while holding button, stop the motor when the button is released) and still keep a correct pulsecounter from position 0? I am also a bit confused on the difference between absolute and relative pulses and how to successfully use the difference in my program.... Edited by Stian
Posted
Have you established an origin using the ORG command? Once you have established the origin,l (home position), you can use absolute or relative commands. Absolute commands mean with respect to the origin. So, if you issue an absolute command of 5, then the servo will move to a position that is 5 pulses from the origin. Therefore this could be a very long move (if you were at position 100,000 when the command was issued) or no movement at all (if you were already at position 5). A relative move of 5 would move you 5 pulses from wherever you are when the move is issued. The pulse counter should not be resetting. I will have to check on that one.
Posted
PLS2 will not be used for the jogging portion. That was what I meant by the (after you have taught the positions) comment. You will need to use ACC to jog. Then use MOVL to store each of the positions and finally use PLS2 to move to the positions when running the machine.
Posted
The pulse position resetting may be because you have not established an origin. I believe once you establish an origin, it will not reset anymore. It is assuming that since you have no origin that you are doing some sort of indexing or feeding application. I will have to test this later today.
Posted
I tested this just now and once you establish origin (using ORG command), the current count register (A276 as a double integer for Pulse output 0) does NOT reset each time that you issue a movement command (Incremental command or relative). You can also use the INI command to establish a home (origin) position, but it is only for defining the position with respect to the where the servo is at when the command is executed. For instance, if you issue this INI command INI #0 #0 D0 and D0 has a value of 0 in it, then the position at which the servo is sitting becomes zero. It is unlikely that this is what you will use, but it is how I did my testing. You will likely have a home switch, you will configure the origin routine in the Settings of the Pulse Output (settings window) and then issue the ORG command.
Posted (edited)
I can guarantee it that I do not have an origin established... I do not know how to do this. On reading the manual on the ORG command I am not entirely sure how to make it work. But my understanding is that if I drive the motor to its origin position (home switch / end position sensor) and then activate the ORG command the PLC will store that position as its origin... Is that correct? If so this is the "magic" position 0 that I have been wanting to use. This is definately a learning experience for me, which is great But sometimes I feel a bit lost as I do not know what I do not know. Like the PRV and ORG commands for example. Being aware that these commands exist and what they are meant to do helps alot as I then can read the manuals. And then, maybe, ask the right questions Thank you very much for your patience! edit: I found the emoticons... how nice! Edited by Stian
Posted
OOh! I like this! It looks like using an origin position, setting positions and then using absolute movement is the entire solution to my project.
Posted
You do not have to drive the motor to the origin position and then issue the ORG command, you simply need to issue the ORG command and it will drive to the origin position. See the image and description below: The basic process is described below: 1. The origin command is issued. The servo does not have to be at any particular location. The servo then accelerates to the origin search high speed. 2. The origin proximity signal is received. This is usually a proximity switch that is installed on the machine and wired to the proper input on the CP1L. 3. The servo decelerates to the Origin search proximity speed after the origin proximity input is received. 4. The Origin Input signal is received. The origin input signal is often the Z-Phase pulse from the encoder on the servo motor. The Z-Phase is a single pulse that happens 1 time per revolution of the motor. The reason that both the proximity switch and the Z-Phase are used together is that the proximity switch timing is not very repeatable. The Z-Phase makes the home position very accurate and repeatable. Please review section 5-2-5-1 of the CP1L Operation Manual (Cat. No. W462) for further information on the origin search process. You can find information here about which inputs to wire the Origin prox and Origin input to a well as information about the different settings related to Origin Search (there are many different ways to do it).
Posted
Mike: The ORG command can be problematic on the CP1L. I did a CP1L-EM30DT1-D system last year that we were simply unable to get ORG to do anything. I contacted both the Disty and Omron factory tech support folks about it an neither one could come up with an answer to the problem. I ended up using the "brute force" method of moving the stepper to the origin and using INI commands to stop the drive reset the origin. I suspect that it might have been an issue with CXP and the EM30 because I have used the ORG command with other CP1L and CP1H units with no problem.
Posted
On 3/25/2014 at 2:48 PM, Michael Walsh said:

Hi, Stian, Michael.....all, 

  I have same problem. Do you solve your? Can you share ladder diagram?

Tank you . 

 

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
×
×
  • Create New...