K300 ML1400 Indexing Example v1 - 0

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Sample Code

Programming Example for a K300 using


Indexing Mode and RSLogix500

K300 ML1400 Indexing Example v1_0


03/16/2010

Sample Code
1) Introduction
This sample code example shows one method to write Index configurations to the Kinetix
300 drive in Indexing Mode via Class 3 explicit messaging.
The Indexing program code takes the values to configure a motion index profile and writes it
to the Kinetix 300 Index Assembly object.
This document will cover the following items:
Steps required for basic drive setup.
Brief explanation of the program code.
Assembly objects layout.

2) Basic Drive Setup


Once you have your MicroLogix system (controller, drive, motor, etc.) connected and
powered up per the installation manual instructions (2097-UM001A-EN-P), you can begin
configuring the Kinetix 300.
Establish an Ethernet connection from your PC to the Kinetix 300s Ethernet port to
configure the drive. Once connected to the drive, navigate to the drives IP address from your
web browser or run the MotionView OnBoard JAVA interface if already installed on your
PC.
See the user manual if you need additional information getting connected.
You will need to complete the following items at a minimum to use the program code in this
example:
Configure the motor. If using a motor with incremental feedback, select the motor
you are using from the listing. If the motor has an absolute programmed encoder it
will be automatically selected. (Note: if your motor has an intelligent encoder, -S,-M,
it will be recognized by the Kinetix 300 drive automatically.)
Set User Units scaling in this example we use 1 rev/motor rev.
Auto Tune the motor (system).
Set the Drive Mode to Ethernet/IP External Reference under the General tab.

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 2 of 7

Sample Code
3) Logix500 Program Code
The example code was written for a MicroLogix 1400 controller. The example code is
located in the following 4 program files:

MAIN Contains timer to execute Power Up program


before scanning the other program files.
POWER UP Initialize/reset program data files.
AX1 MNTR Reads drive status from the Input
Assembly object and writes drive parameters to the Output
Assembly object.
AX1 PROG Contains control and motion application code. The code within the
program shows an example of how to:
o Enable the drive
o Disable the drive
o Fault Reset this is done via Explicit Message Instruction
o Configure and run two different index moves. The indexes are built by writing
to the K300 Index Assembly object. Use the Custom Data Monitors to
change the index values.
o Stop motion

Note: You will need to modify three (3) message instructions to enter in the IP Address of
the Kinetix 300 drive in your system. They are located as follows:

LAD 190 AX1 MNTR: Rungs 0 and 2


LAD 191 AX1 PROG: Rungs 3, 5, 8 & 10

Example:
Open the MSG Setup Screen.

Go to the MuliHop tab and enter in your IP Address in the To Address box.

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 3 of 7

Sample Code
4) Assembly Objects Layout
The Input Assembly is identified by Instance 113 and consists of the following 64 bytes (see Appendix C
of the User Manual, 2097-UM001, for detailed descriptions of each of these fields):
Bytes

Bit 7

Bit 6

Reserved

Registration
Captured

Bit 5
Current
Limit
Reached

1-3
4

Reserved

Homed

Homing
Active

Reserved

Reserved

Reserved

Bit 1

Bit 0

Reserved

Reserved

In Position

Fault

Enabled

Reserved

Motion
Complete

Indexing
Active

Ready

In Speed
Window

Zero
Speed

Input A3

Input A2

Input A1

Input C3

Input C2

Input C1

Neg. Limit
Switch
Engaged

Pos. Limit
Switch
Engaged

Reserved

Reserved

Reserved
Input B4

Input B3

Input B2

13-15
16

Bit 2

Reserved

9-11
12

Bit 3

Reserved

5-7
8

Bit 4

Input B1

Input A4

Reserved
Reserved

Reserved

Reserved

17-19

Reserved

Input C4

Reserved

20-23

Active Index (DINT)

24-27

Actual Velocity in UU/second (REAL)

28-31

Actual Position in UU (REAL)

32-35

Command Position in UU (REAL)

36-39

Position Error in UU (REAL)

40-43

Phase Current in Amps (REAL)

44-47

Registered Position in UU (REAL)

48-51

Data Link A (DINT)

52-55

Data Link B (DINT)

56-59

Data Link C (REAL)

60-63

Data Link D (REAL)

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 4 of 7

Sample Code
The Output Assembly is identified by Instance 114 and consists of the following 52 bytes (see Appendix C
of the User Manual, 2097-UM001, for detailed descriptions of each of these fields):
Bytes
0

Bit 7
Drive
Enable

Bit 6

Bit 5

Bit 4

Reserved

Start
Homing

Abort
Homing

1-3
4-7

Bit 3

Bit 2

Define
Home

Start
Motion

Bit 1
Reserved

Bit 0
Abort
Index

Reserved
Starting Index, applies only if drive mode is Indexing (DINT)
External Reference, applies only if drive mode is External Reference (DINT):
0 = current
1 = velocity

8-11

2 = incremental position
3 = absolute position
4 = incremental registration
5 = absolute registration
2

(REAL)

(REAL)

12-15

External reference maximum acceleration in UU/second

16-19

External reference maximum deceleration in UU/second

20-23

External reference current in Amps or Velocity in UU/second (REAL)


field )

24-27

External reference maximum velocity in UU/second (REAL)

28-31

External reference position in UU (REAL)

32-35

External reference registration displacement in UU (REAL)

36-39

Data Link A output (DINT)

40-43

Data Link B output (DINT)

44-47

Data Link C output (REAL)

48-51

Data Link D output (REAL)

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 5 of 7

(Mode dependant

Sample Code
The Index Assembly is identified by Instance 115 and consists of the following 48 bytes (see Appendix E
of the User Manual, 2097-UM001, for detailed descriptions of each of these fields):

Bytes
0-3

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Index Number, valid entries are 0-31 (DINT)


Index Type (DINT)
0 = Absolute

4-7

1 = Incremental
2 = Registration Absolute
3 = Registration Incremental
4 = Blended
Index Move Type/Motion Profile (DINT)

8-11

0 = Trapezoidal
1 = S-Curve

12-15

Index Distance in UU (REAL)

16-19

Index Batch Count (DINT)

20-23

Index Dwell in ms (DINT)

24-27

Index Velocity in UU/second (REAL)

28-31

Index Maximum Acceleration in UU/second (REAL)

32-35

Index Maximum Deceleration in UU/second

36-39

Index Next Index, valid entries are 0-31 (DINT)

(REAL)

Index Action (DINT)

40-43

0 = Stop
1 = Wait For Start
2 = Next Index

44-47

Index Registration Distance in UU (REAL)

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 6 of 7

Bit 2

Bit 1

Bit 0

Sample Code

Disclaimer
This sample code delivered by Rockwell Automation is just an example of how to control a
K300 drive.
Disclaimer Of Warranty
THE MATERIALS DELIVERED WITH THIS EXAMPLE ARE PROVIDED "AS IS" WITHOUT
WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION,
ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
NONINFRINGEMENT OR OTHER VIOLATION OF RIGHTS. ROCKWELL AUTOMATION DOES NOT
WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE, VALIDITY, ACCURACY, OR
RELIABILITY OF, OR THE RESULTS OF THE USE OF, OR OTHERWISE, RESPECTING THE
MATERIALS MAINTAINED ON OR ACCESSED BY WAY OF THIS SITE OR ANY WEB SITES LINKED TO
THIS SITE. FURTHERMORE, ALL WARRANTIES, CONDITIONS, REPRESENTATIONS, INDEMNITIES
AND GUARANTEES WITH RESPECT TO THE ACCURACY, OPERATION, CAPACITY, SPEED,
FUNCTIONALITY, QUALIFICATIONS, OR CAPABILITIES OF THE SOFTWARE, SYSTEMS AND
SERVICES COMPRISING OR UTILIZED IN THE OPERATION OF THIS CODE, WHETHER EXPRESS OR
IMPLIED, ARISING BY LAW, CUSTOM, PRIOR ORAL OR WRITTEN STATEMENTS BY ROCKWELL
AUTOMATION, OR OTHERWISE (INCLUDING, BUT NOT LIMITED TO ANY WARRANTY OF
SATISFACTORY QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT) ARE HEREBY EXPRESSLY EXCLUDED AND DISCLAIMED.
Disclaimer Of Liability
UNDER NO CIRCUMSTANCES (INCLUDING NEGLIGENCE) WILL ROCKWELL AUTOMATION BE
LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES (INCLUDING WITHOUT LIMITATION, BUSINESS INTERRUPTION, DELAYS, LOSS OF DATA
OR PROFIT) ARISING OUT OF THE POSTING (OR THE INABILITY TO POST) OR THE USE (OR THE
INABILITY TO USE) THE DELIVERED CODE EVEN IF ROCKWELL AUTOMATION HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES.

K300 ML1400 Indexing Example v1_0


03/16/2010

Page 7 of 7

You might also like