Back to Blog
Applications and How-Tos

KEB Drive Control Using the CiA 402 Drive Profile and Logix 5000

Conner Glaser | December 10th, 2024

This article is part 3 of a series to program an Allen Bradley PLC in Studio 5000 software to control a KEB S6/F6 Drive. This is a continuation of two previous blog posts focusing on Ethernet/IP communication. Please click the links below if you have not reviewed the following guides on how to (1) set up your project and (2) establish implicit and explicit messaging.
 

  1. (1 of 3) Ethernet/IP Setup Guide: Allen Bradley PLC and KEB Drive
  2. (2 of 3) Implicit and Explicit Messaging for Allen Bradley PLCs and KEB Drives

 
Before starting this tutorial, confirm that you meet the software and hardware requirements for Ethernet/IP PLC programming and for establishing communication between a KEB drive and a CompactLogix 5380 PLC.

One more thing before you begin: Prevent connection issues by ensuring the KEB_S6A module’s Ethernet address is configured to match fb109. Additionally, verify that the PLC port connected to the X4B port on the drive is in the same subnet as the drive but uses a unique IP address. You can adjust this setting in the “Controller Properties” under “Internet Protocol.”

Now let’s get into the tutorial to begin Ethernet/IP PLC programming.

 

KEB Drive Control Data Block

A user-defined data type has been created that aligns with the CiA402 standard that KEB drives utilize. The members of this data type correspond to different bits in the controlword and statusword of the KEB drive. After defining an instance of KEB_Cia402_DriveControl, bits of the data type can be written-to and read.

 

Drive control data block for CiA402 inside COMBIVIS 6 software for EthernetIP PLC programming
Fig. 1 – Drive control data block for CiA402 inside COMBIVIS 6 software for EthernetIP PLC programming

 
Definition ex.

  • structure name: Drive1
  • type: KEB_Cia402_DriveControl

Implementation ex.

  • Drive1.EnableOperation = TRUE
  • Drive1.TargetVelocity = 2000
  • CurrentPosition = Drive1.PositionActualValue

 

Configure State Machine with Digital Inputs

To facilitate integration, test communication, and ensure proper connection of all components, a sample state machine and project have been created.

  • Implicit Messaging is implemented in the “DriveControl” routine.
  • Explicit Messaging is utilized in the “INIT” routine.
  • The Drive Control data type is used in both the “StateMachine” and “DriveControl” routines.

This sample state machine relies on four digital inputs, detailed as follows:

  • Digital Input I1: HIGH = step through init (needs to be high to run)
  • Digital Input I2: HIGH = STOP
  • Digital Input I3: HIGH = RUN
  • Digital Input I5: HIGH = fault reset
  • Digital Input I6: LOW = velocity mode active , HIGH = positioning mode active

The following sections overview each state in the program state machine. Below is the CiA402 State Machine that the drive utilizes.

 

CiA402 State Machine flowchart from 24v supply to the motor torque using EthernetIP plc programming
Fig. 2: CiA402 State Machine

The drive’s internal state machine is controlled via the co00 (CiA 0x6040) controlword and internal events (from errors). The actual state is displayed via st00 (CiA 0x6041) statusword. The actual state can be determined additionally via st12 state machine display. The main path through the state machine that will be covered is 1 to 2, 2 to 3, 3 to 4, and 4 to 17. The user-defined data type (covered earlier) will be used to manipulate the controlword and move through the CiA402 state machine.

 

Stop and Fault States

At any point in the program state machine, the stop state can be triggered by a rising edge of DI2. Upon entry into the stop state, both the “enable operation” bit and the brake bit are deactivated (brake closed). This is equivalent to the transition from “operation enabled” to “disable operation active” to “switched on” in the CiA402 state machine.

 

Programming Stop and Fault States for EthernetIP communication in Rockwell plc software
Fig. 3: Stop and Fault States

 
If the drive is stopped or in a fault state, all digital inputs need to be switched to low before re-entering the init state and enabling operation. The fault state corresponds to paths 14 and 15 in the CiA402 state machine, transitioning from “fault reaction active” to “fault” and finally to “switch on disabled” upon returning to the initialization state. A fault reset can be triggered by a rising edge of DI5.

 

Initialization State for EthernetIP programming in Allen Bradley PLC software
Fig. 4: Initialization State

 
The init state is defined by rungs 2–4. Initially, the “INIT” routine is executed and remains active until a rising edge on DI1 is detected.

The timer in rung 3 provides enough time for the init state to complete all necessary writes, even if DI1 is already high. Once DI1 goes high and the timer expires, the “INIT” routine is deactivated, and rung 4 transitions to active.

Rung 4 represents the transition from state 1 to state 2 to state 3 in the CiA402 state machine. By activating the switch-on bit, the enable voltage bit, and the no quickstop bit, the CiA402 state machine enters the “switched on” state. At this point, the drive is still awaiting the activation of the enable operation bit before any movement can occur.

It is essential that both the enable voltage bit and the switch-on bit are activated prior to the activation of the enable operation bit.

 

Check for Mode

 

Check For Mode Rung for EthernetIP plc programming in Studio 5000 Logix Designer
Figure 5 – Check For Mode Rung

Rung 5 represents the state where the drive determines the selected mode based on the status of DI6.

  • If DI6 is high, positioning mode is activated by setting the mode to 1.
  • If DI6 is low, velocity mode is activated by setting the mode to 2.

A timer is included to ensure sufficient time for writing the parameters of the selected mode.

In general, setting values to variables can be accomplished by using “MOV” blocks within Studio 5000.

 

Velocity Mode

The writing state for velocity mode is depicted in rung 6. In velocity mode, only the target velocity needs to be written for a simple constant speed with standard ramp settings. The duration of this state is controlled by the timer block in rung 5. Once the timer completes the set duration, the ladder flag for “RUN_VELOCITY” is activated.

 

How to Set Velocity and enable operation in velocity mode with Studio 5000 Logix Designer
Figure 6 – Set Velocity Mode

 
Once the ladder flag for “RUN_VELOCITY” is set and DI3 is high, the enable operation bit is set.

Rung 8 represents the transition from state 3 to state 4 to state 17 in the CiA402 state machine, operating in velocity mode. When the “enable operation” bit is set, the motor begins to rotate at the specified “target velocity.” The motor will continue spinning until a rising edge of DI2 or a falling edge of DI3 detected, which will trigger the stop condition and the disable operation condition, respectfully.

 

Positioning Mode

The writing state for positioning mode is depicted in rung 7. In positioning mode, the profile velocity (speed during positioning), target position, and end velocity (speed at the target) must be configured. The duration of this state is managed by the timer block in rung 5. After the timer completes, the ladder flag for “RUN_POSITIONING” is activated.

Once the ladder flag for “RUN_POSITIONING” is set and DI3 is high, the enable operation bit is activated.

Rungs 8 and 9 represent the transition between state 3, state 4, and state 17 in the CiA402 state machine.

 

Enable Operation - Positioning Mode in Studio Logix 5000
Figure 7 – Set Positioning Mode and Enable Operation in Positioning Mode

 
When the set point is acknowledged by the drive (drive response), the motor begins to rotate. Unlike velocity mode, in positioning mode, the motor will only rotate if the “new set point” bit is set, provided the enable operation bit is already active. After the set point is acknowledged by the drive, the “new set point” bit can be deactivated.

 

Conclusion

With this setup guide, you should complete PLC programming in Ethernet/IP using Rockwell’s Studio 5000 software to communicate with a KEB S6/F6 drive. Please a contact a KEB applications engineer if you have any questions.

Contact Us

Let's Work Together

Connect with us today to learn more about our industrial automation solutions—and how to commission them for your application.

  • This field is for validation purposes and should be left unchanged.