For our example, we want to perform the following cycle using PLC control of the Left MDR on an :
- Establish a zero or home position by external input to PLC (sensor or operator button)
- Rotate in the CCW direction for 7000 pulses at a speed of 80% PWM with acceleration ramp of 100 pulses and a deceleration ramp of 50 pulses
- Rotate the CW direction for 9000 pulses at a speed of 100% PWM with acceleration ramp of 50 pulses and a deceleration ramp of 10 pulses.
- Rotate CCW back to the zero or home position at a speed of 80% PWM with acceleration ramp of 50 pulses and a deceleration ramp of 10 pulses.
- Wait for a cycle dwell time of 4 seconds and then repeat the rotation cycles
Define PLC Tags
Tag Name | Data Type | Assembly Register (/bit) |
---|---|---|
ZERO | Boolean | Left Servo Command Word – bit 0 |
ZERO_ACK | Boolean | Left Motor Servo Status – bit 1 |
RUN | Boolean | Left Servo Command Word – bit 1 |
READY | Boolean | Left Motor Servo Status – bit 0 |
POSITION | Integer | Left Servo Command Pulses |
SPEED | Integer | Left Motor Speed Reference |
ACCEL | Integer | Left Motor Acceleration Ramp |
DECEL | Integer | Left Motor Deceleration Ramp |
MODE | Integer | Left Motor Speed Control Method |
Sequence of Operation
Step #1: Place Left Motor in Closed Loop Mode by writing a “2” to MODE
Step #2: Upon external signal from sensor or button, set ZERO bit to establish zero or “home” position. When PLC sees that the ZERO_ACK bit is set, then the PLC resets the ZERO bit.
Step #3: To make the first rotation, we need write the speed, ramp values, and distance to rotate to the appropriate registers:
- Write 800 to SPEED
- Write 100 to ACCEL
- Write 50 to DECEL
- Write 7000 to POSITION
Step #4: If READY is reset, then the PLC can set the RUN bit to begin the rotation. When the rotation is complete, the ERSC sets the READY bit. This will be the signal to the PLC to reset the RUN bit. Once the ERSC sees that the RUN bit has been reset, it will reset the READY bit.
Step #5: For the second rotation, we need to write the speed and ramp values to the appropriate registers:
- Write 1000 to SPEED
- Write 50 to ACCEL
- Write 10 to DECEL
Because we want to rotate in the opposite direction, we need to determine the new location based upon the zero or “home” position. In this case, we know we went 700 pulses “forward” and we want to move 900 pulses “backward”. The position we want to end up is 7000-9000 = -2000.
- Write -2000 to POSITION
Step #6: Repeat Step #4
Step #7: For the 3rd rotation, we keep the ramp values from the 2nd rotation, but we need to set the speed and the position to rotate. In this case we want to go to the zero or “home position.
- Write 800 to SPEED
- Write 0 to POSITION
Step #8: Repeat Step #4