Sunteți pe pagina 1din 151

Motion Control

Developed by Advantech IAG Training Center


(Internal Use Only)
I

Table of Contents
Table of Contents..................................................................................................I

Chapter 1 Introduction..........................................................................................1
1.1 Industry Overview......................................................................................1

1.2 Application Story.......................................................................................2

1.3 Learning Purpose......................................................................................11

1.4 Structure of the Textbook.........................................................................11

Chapter 2 Essential Concepts..............................................................................13


2.1 Motion Control System............................................................................13

2.2 Types of Motors.......................................................................................16

2.3 Motion Control Mode...............................................................................17

2.4 Pulse Types of Motion Control................................................................21

2.5 Speed Profile of Motor Driving...............................................................22

2.6 Interpolation.............................................................................................24

2.7 Position Compare.....................................................................................28

2.8 Position Latch...........................................................................................29

2.9 Quiz..........................................................................................................29

Chapter 3 Product Introduction.........................................................................31


3.1 Centralized Motion Control System.........................................................31

3.2 Decentralized Motion Control System.....................................................32

3.3 Product Selection Guide...........................................................................36

3.4 Centralized vs. Decentralized...................................................................39

3.5 Quiz..........................................................................................................40

Chapter 4 Getting Started...................................................................................42


4.1 Centralized Motion Control System.........................................................42

4.2 Practice for Centralized System...............................................................56


II

4.3 Decentralized Motion Control System.....................................................65

4.4 Pratice for Decentralized System.............................................................76

4.5 Hands on Exams.......................................................................................83

Chapter 5 Software Introduction (Advanced)...................................................86


5.1 Programming Introduction.......................................................................86

5.2 Microsoft Visual Studio Introduction.......................................................87

5.2.1 DLL Programming for Centralized System.................................87

5.2.2 DLL Programming for Decentralized System............................104

5.3 Labview for Centralized Motion Control...............................................117

5.4 Introduction of MultiProg KW...............................................................120

5.5 Multiprog KW Programming of Motion................................................120

5.5.1 Basic Configuration of Multiprog KW......................................121

5.5.2 Motion Function Introduction of Multiprog KW.......................127

5.5.3 Advanced Motion Function of Multiprog KW..........................134

5.6 KW and SCADA Integration..................................................................142

5.7 Quiz........................................................................................................144

References.........................................................................................................147
References1

Chapter 1 Introduction

1.1 Industry Overview

The automation industry contains a variety of automation, like building

automation, machine automation, environmental monitoring system automation, and

etc. The overview is shown in Figure 1 -1.

Figure 1-1 eAutomation Overview

Due to the fact that the environment of industrial applications is always tough,

some specifications such as the temperature tolerance and vibration protection are

getting important. As a result, companies supplying industrial equipments devote their

attention to the way of making products more reliable and flexible. For example,

industrial computers come with more PCI slots so as to meet the need of system

expansion; in building automation, the combination of fanless platforms (ex: UNO

Advantech IAG Training Center (Internal Use Only)


2 Software Introduction (Advanced)

series) and remote I/O modules (ex: ADAM-4000/6000 series) is usually adopted to

ensure the security of buildings; in power and energy automation, green devices (ex:

xxx) can bring the efficiency of power consumption and reduce the emission of

greenhouse gas; in machine automation, distributed motion control devices (ex:

AMAX series) facilitate the implementation in a more cost-effective way. To be a

machine designer, it is imperative to consider the motor moving theory and machine

protection; however, the most important thing is how to increase the speed of

manufacturing process and prevent the machine mechanism from damage in any

situation or operation. This textbook, therefore, will focus on the basic knowledge of

motion control system so that beginners will know how to use these modules in

relation to motion automation.

1.2 Application Story

There are a great diversity of applications in motion automation. This section

will introduce the most popular applications of motion control system. After viewing

these applications, users will learn more about motion automation.

Decentralized motion control in solar cell loader/unloader application

Solar cells convert solar energy into electricity through the photovoltaic effect,

Advantech IAG Training Center (Internal Use Only)


References3

which is useful for many applications. Individual cells can be used for powering small

devices, such as electronic calculators, while the larger photovoltaic arrays can

generate a significant amount of renewable electricity. One machine builder in Taiwan

integrated a wide range of Advantech products so as to meet the requirements of the

solar cell loader/unloader project which was aimed at reducing wiring costs and

improving the reliability of Ethernet communication infrastructure.

The existing motion control system adopted by this customer is highly

complicated, that makes system maintenance and troubleshooting much difficult and

expensive. In order to reduce the cost and increase the reliability, the customer

expects to implement a decentralized motion control solution which requires:

High performance products with great reliability

A simplified Ethernet infrastructure to reduce wiring

The ability to integrate all production information into MES and CIM systems

In this solution, AMAX-2241/PMA was used to control the conveyer belt and the

solar cell lifting mechanisms. Due to special concerns from the customer, we

successfully created a special junction cable allowing AMAX-2241/PMA to integrate

with a Panasonic servo motor. AMAX-2752SY/ 2754SY was adopted to integrate all

light indicators, switches and buttons. UNO-3074 is the main controller of the whole

system, it not only communicates with the solar cell process controller but also sends

motion control commands to AMAX-2000 series modules through PCI-1202U;

Advantech IAG Training Center (Internal Use Only)


4 Software Introduction (Advanced)

besides, all of production information is also stored here for further integration into

MES and CIM systems.

Leveraging the flexibility of a decentralized motion control system with

Advantech products was the only way to meet the strict demands of this project. The

new solar cell loader/unloader machine reduced the dimension of the distribution

panel by 50% and reduced the overall wiring of the system by 37%. In addition, the

performance increased 23% by simplifying the architecture of the system (i.e.,

replacing out-of-date centralized motion control architecture with our decentralized

motion control solution). Compared with the old system, this new one was relatively

easier to maintain and troubleshoot; in other words, the customer no more needs to

stop production line and open the chassis of the machine to maintain plug-in motion

control and DAQ cards. The system diagram is shown in Figure 1 -2.

Figure 1-2 solar cell loader/unloader system diagram

Advantech IAG Training Center (Internal Use Only)


References5

Decentralized motion control in a handler application

Although the global semiconductor market was relatively flat in 2007, back-end

semiconductor machine builders in Asia still experienced strong growth, especially in

test and handler machines. Due to the high cost of those machines, many customers

chose to inspect the dies manually with a microscope to reduce operation costs. Using

this method though, performance and yield rate were very low. Recently a machine

builder developed a PC-based handler system with centralized motion control

solution, but the system was very complex and the dimensions were quite big. The

machine builder turned to Advantech seeking help to decrease the complexity of the

electronic components while increasing the reliability and performance of the system.

This customer was considering to phase in new automatic test equipments that

fulfilled below requirements:

Reduce the size of equipments (overall dimensions)

Integrate both motion control and digital I/O interfaces

Can integrate Panasonic and Sanyo servo motor drivers

All of production information can be integrated into both MES and CIM systems

This handler system was composed of an IACP-4000D, PCI-1739U, PCI-1202U

Advantech IAG Training Center (Internal Use Only)


6 Software Introduction (Advanced)

and 8 AMONet slave modules. PCI-1739U served as the loader/unloader of the IC

components in different segments. AMAX-2752SY/AMAX-2754SY was used to

control the power and the LEDs of the machine. Advantech offered a customized

circuit which allowed AMAX-2241/PMA to fit both Panasonic and Sanyo motor

drivers. The complex PC-based control scheme was completed through the

implementation of the AMAX-2000 series products.

Leveraging decentralized motion controls flexibility and technology were the

only way to meet our customers demands. This new handler machine reduced the

dimension of the distribution panel by 50% and saved wiring and effort by 33%. It

also increased performance by 20% and simplified the architecture (decentralized

instead of centralized motion control). In the past, the customer needed to open the

chassis to maintain plug-in cards, but now its not necessary. Furthermore, the

consistent outlook and dimension of AMAX-2000 series brought more add-on value

to machine builders, and its DIN-rail mounting also facilitated easy installation. The

system diagram is illustrated in Figure 1 -3.

Advantech IAG Training Center (Internal Use Only)


References7

Figure 1-3 Handler system diagram

Decentralized motion control in laser carving machines

One customer in Taiwan developed variant electronics manufacturing machines.

The customer received a new order for laser carving machines, and wanted to upgrade

their existing motion control solution so as to reduce the complexity of the system

architecture and the size of the machine. The customer had been evaluating our

AMAX-2000 series, but was a bit concerned that the connector was different from the

current solution. Advantech was willing to modify the design of the AMAX-2000

series, creating new and unique AMAX-2000 series modules for this customer.

The new laser carving system this customer would like to implement needs to

meet below requirements:

The smaller size of distribution panel to fit the need of machine dimensions

The compatibility between new solution and existing system

The ability to integrate production information into MES and CIM systems

UNO-3072L featured an onboard DI/O interface which was useful for power

management issues. After finishing all production in the factory floor, the operator

could press the shut down button to trigger the digital input of UNO-3072L to close

the application program and the operating system. After that, the digital output of

UNO-3072L would be enabled to notify the main controller to turn off the whole

Advantech IAG Training Center (Internal Use Only)


8 Software Introduction (Advanced)

system power. This function would not only protect UNO-3072L and its relative

interfaces but also bring better performance and lower maintenance effort.

Furthermore, PCI-1620A enabled the carving machine to communicate with more

devices through RS-232, that indicated PLCs and motor sets outside the system could

be integrated as well.

Most of the machines were required to reduce the dimension. Embedded

automation computers plus AMAX-2000 series could meet this demand. This solution

was more robust than traditional IPCs, and could save much wiring and maintenance

effort. It was the best choice for electronics manufacturing machines. This new laser

carving machine reduced 50% of the panel dimension and saved 33% of the wiring

time and effort, it increased the performance by 20% through a simplified architecture

(decentralized motion control architecture) as well as the flexibility for future

expansion. The system is shown in Figure 1 -4.

Figure 1-4 Laser carving system diagram

Advantech IAG Training Center (Internal Use Only)


References9

High speed injection modeling machines

Injection molding machines were used for manufacturing plastic parts, and in

recent years many of these machines had begun integrating intelligent features with

energy-saving capabilities. Additional functions, such as electronic measurements,

calculators, network communications, real-time auto-control, automatic adjustments

and auto system diagnosis were being integrated as well, not only improving systems

reliability but also increasing machine owners competitiveness in the market.

The purpose of this solution was to integrate an older injection molding machine

with a new Programmable Automation Controller (PAC). The customer was looking

for the approach to following benefits:

Improved precision and stability, with a quick response time

Improved energy-efficiency

Complete closed-loop control with a high degree of accuracy

A very low temperature variance to improve injection stability

Injection location at 0.01 mm, over 10 times than hydraulic driving machine

High power output, with a quick dynamic response rate

Touch-screen operation, reasonable price

ADAM-5550KW integrated into this system increased the injection molding

Advantech IAG Training Center (Internal Use Only)


10 Software Introduction (Advanced)

machines response time through high-speed analog input, monitored its closed-loop

process through analog output, and controlled related machines motion through

digital input and output, so as to manage the location and dose of objectives through

the high-speed calculator module. The various modules inserted to the PAC could also

control diverse devices, such as push buttons, LED indicators, thermometer, heating,

storage, and so on. With FPM-3120G (12.1 LCD panel with resistive touch-screen),

the customer has a higher degree of control over energy efficiency.

Taking advantage of ADAM-5550KW, the customer improved production speed,

reliability and power consumption. Additionally, this solution saved maintenance and

production costs for the customer. The system diagram is shown in Figure 1 -5.

Figure 1-5 High speed injection system diagram

Advantech IAG Training Center (Internal Use Only)


References11

1.3 Learning Purpose

The purpose of this textbook aims to assist beginners to learn the basic concept

of motion control and understand how to use Advantech motion modules. If you are

already familiar with this, please go to for advanced software programming. After

reading this textbook, we expect that the users can know the architecture of motion

control system well and enhance the skill of using Advantech utilities and examples in

relation to the control of servo motors. The users can go further to base on the

examples described in the textbook to develop their own applications.

1.4 Structure of the Textbook

This textbook will be separated into six chapters. In Chapter 1, the overview of

industry, the application story of the motion control and whats the rule of the motion

control will be introduced in Section 1.2. In Chapter 2, the essential basic concept will

be described in more detail. The motion control system, actually, is like the human

moving, the differences between these two closed loop motion control systems will be

discussed in Section 2.1. The types of motors, motion control mode, pulse type of

motion control system will be illustrated in Section 2.2, 2.3, and 2.4. The types and

functions of the speed profile for motion control will be explained in Section 2.5.

Some advanced functions such as interpolation, position compare, and position latch

Advantech IAG Training Center (Internal Use Only)


12 Software Introduction (Advanced)

will be defined in Section 2.6, 2.7, and 2.8.

In Chapter 3, how to select the most suitable products to meet real situation will

be addressed. The structure of centralized and decentralized motion control systems

will be explained in Section 3.1 and 3.2. In Section 3.3 and 3.4, there are some tips for

the users about how to select products to match their needs and recognize the

differences between centralized and decentralized motion control systems. In Chapter

4, the startup of the centralized and decentralized motion control systems will be

demonstrated step by step. It contains system diagram, connection diagram, utility

operation and some hands-on practices.

In , the software for Advantech motion modules will be introduced. In Section

5.2, the users will experience the programming tutorial of Microsoft Visual Studio

DLL programming. In Section 5.3, Labview software will be illustrated, especially for

PCI-1240U in centralized motion control systems. Through this section, the users will

be familiar with the way of using Labview software to control PCI-1240U. In Section

5.5 and 5.6, KW Multiprog programming will be highlighted and the users will learn

how to control the motion modules through KW. Furthermore, KW software can be

integrated with SCADA software such as Advantech Studio and WebAccess through

Modbus/TCP communication protocol.

Advantech IAG Training Center (Internal Use Only)


References13

Chapter 2 Essential Concepts

In order to learn more about motion control, this chapter will introduce the basic

knowledge and advanced function of motion control. The operation principle of

motion control system will be addressed in this chapter.

2.1 Motion Control System

Motion control system can be viewed as an action done by human. Please refer

to Figure 2 -6. The controller works as the brain to collect necessary information,

conduct calculation and make decisions. Motors and their corresponding drivers

provide power to move. Ball-screw and hardware are adopted to execute proper move.

In the end, vision devices and sensors detect the result and feedback information to

the controller. The closed loop control enables the controller to correctly react to

changes in the environment, just like what a human being does.

Advantech IAG Training Center (Internal Use Only)


14 Software Introduction (Advanced)

Figure 2-6 Motion Control system

PC-based control system is shown in Figure 2 -7. In the application market,

most companies adopt such control structure. In this structure, PCI card sends basic

function (ex: point to point, continuous move, and homing) and advanced function

(ex: linear interpolation and circular interpolation) commands to servo motor. The

servo driver takes advantage of closed loop control to manage the servo motor to

reach the pre-defined position accurately.

Advantech IAG Training Center (Internal Use Only)


References15

Figure 2-7 PC-based Motion Control System 1

Another control structure is shown in Figure 2 -8 and it is for advanced

application. Some customers doubt the accuracy of the motor and gear combination.

For this reason, linear scale is adopted to measure the real position of the end point.

Thus, the second closed loop is used in order to get more accurate position control.

Figure 2-8 PC-based Motion Control System 2

Advantech IAG Training Center (Internal Use Only)


16 Software Introduction (Advanced)

2.2 Types of Motors

Generally, there are a lot of types of motors shown in Figure 2 -9. For the most

general motor, it just can be controlled by direction with constant speed. Such type of

motor is usually used in car models or other toys. The second general type of motor

has brake and clutch function, which can be stopped immediately so as to prevent the

motor from damage. If the motor has inverter, the user can control the acceleration

and deceleration. Stepping motor can do position and speed control. Basically,

stepping motors can be adopted for most of low-end applications. The four types of

motors described above do not involve encoder feedback. As a result, the user cant

know exactly what the real position is. In the industrial field, if customers want to do

precision control, servo motor is preferred and more popular. Therefore, there are

many companies devoting to develop servo motors, such as Mitsubishi, Panasonic,

and Yaskawa.

Advantech IAG Training Center (Internal Use Only)


References17

Figure 2-9 Types of Motors

2.3 Motion Control Mode

Due to the fact that servo motors are usually adopted for industrial applications,

this section will put a stress on the introduction of the control mode of servo motors.

1. Pulse Command Mode

Position Control

Position control is mostly used in common motion application, and it is easy to

understand its operation principle. The motion controller sends the servo motor the

Advantech IAG Training Center (Internal Use Only)


18 Software Introduction (Advanced)

pulse type command so as to control the motor to reach the target. The frequency of

the pulses, in fact, can determine the position, speed, and acceleration/deceleration.

The position control system contains a position controller, servo motor, and

encoder feedback. The system diagram is shown in Figure 2 -10.

Figure 2-10 Position control system diagram

First of all, the controller sends commands out, including end point, initial

speed, maximum speed, and acceleration/deceleration. When the servo driver receives

the commands, the servo motor is managed through the closed loop position control to

reach the target with desired velocity and acceleration/deceleration. Under this control

mode, the key issue is whether the motor arrives at the end position. If readings from

the logical counter and the real counter are not consistent (i.e., not arrive at the end

position), the servo driver will keep driving the motor until both readings are the

same..

2. Voltage Command Mode

Speed Control

Speed control means that the motor speed is controlled by different voltage. For

instance, the speed of a DC motor is directly proportional to the voltage supplied, if

Advantech IAG Training Center (Internal Use Only)


References19

the supply voltage is descreased from 12 to 6 Volts, the speed of motor will be in half.

The system diagram of speed control is shown in Figure 2 -11.

Figure 2-11 Speed control system diagram

The striped thing between the motor and the dc generator is a shaft which

couples them together in a mechanical way. The motor drives the generator

(tachometer) via this shaft. The set speed control provides a dc voltage, say 12 volts

for maximum speed and zero for stationary. This could be a potentiometer providing

any voltage in a range from zero to +12 volts. The difference amplifier will magnify

the difference between its two input voltages. If the motor is stationary but the speed

control is moving to half of max speed, there must be a variation between two inputs

of the difference amplifier (i.e., speed control and tachometer). Consequently, the

difference amplifier will output a voltage to next stage.

Since this voltage is not high enough to drive the motor, it needs to be magnified

through the DC amplifier. A DC amplifier is a special type of amplifier which can

proportionally enlarge DC voltages. For example, 10 volts DC input could become

100 volts DC output. This amplified DC voltage enables the DC motor to increase its

speed of rotation. This in turn drivers the tachometer to produce a voltage based on

the speed of the motor. When the output voltage of the tachometer gradually increases

and reaches the voltage of "set speed", the outputs of the difference amplifier and DC

Advantech IAG Training Center (Internal Use Only)


20 Software Introduction (Advanced)

amplifier become zero, so the motor stays at correct speed. However, the motor is no

longer driven by the DC amplifier, its speed starts decreasing. As a result, the

tachometer output voltage becomes declined, and a difference between two inputs of

the difference amplifier is appeared, so the difference amplifier and DC amplifier

work again to correct this drop in speed. In a poorly designed system, the drop in

speed and its correction process could lead to the phenomenon of "hunting" (i.e., a

regular variation in speed).

Torque Control

Direct torque control (DTC) is one method used in variable frequency drives to

control the torque (and thus finally the speed) of three-phase AC electric motors. This

involves calculating an estimate of the motor's magnetic flux and torque based on the

measured voltage and current of the motor.

Stator flux linkage is estimated by integrating the stator voltages. Torque is

estimated as a cross product of estimated stator flux linkage vector and measured

motor current vector. The estimated flux magnitude and torque are then compared

with their reference values. If either the estimated flux or torque deviates from the

reference more than allowed tolerance, the transistors of the variable frequency drive

are turned off and on in such a way that the flux and torque will return in their

tolerance bands as fast as possible. Thus direct torque control is one form of the

hysteresis or bang-bang control.

Advantech IAG Training Center (Internal Use Only)


References21

2.4 Pulse Types of Motion Control

Generally, there are three pulse types of output/input signals of position control

as shown in Figure 2 -12, namely AB phase, CW/CCW and Pulse/Direction.

Figure 2-12 Pulse type of position control

They all use 2 input signals to decide the position. For CW/CCW mode, one

signal (CW) is used as the positive command whereas the other (CCW) is used as

negative command. For Pulse/Direction mode, the signals Direction and Pulse

determine the direction and the distance of the move respectively. For AB phase, it is

mostly used in the industrial application. If the signal A leads B by a rising or

falling edge, then the number of steps will be added by one, and vice versa. Due to the

phase shift feature of AB phase, the impact of noise interference can be minimized.

Advantech IAG Training Center (Internal Use Only)


22 Software Introduction (Advanced)

2.5 Speed Profile of Motor Driving

In order to match different motion applications, speed profile is necessary and

important. Users can take advantage of speed profile to have the motor meet the

requirements of moving.

There are two types of acceleration/deceleration profiles, that is, T-curve and S-

curve, which are shown in Figure 2 -13 and Figure 2 -14. T-curve is the speed profile

adopted for most applications often. Giving an acceleration, the time from initial

speed to driving speed can be decided.

Figure 2-13 Trapezoidal curve driving

If the load the motor carries is heavy, S-curve speed profile may be taken into

account. The feature of S-curve is that the acceleration/deceleration is increasing in

the beginning and decreasing in the end, rather than constant acceleration/deceleration

in T-curve speed profile. This way can avoid mechanical damage caused by rapid

change in speed.

Advantech IAG Training Center (Internal Use Only)


References23

Figure 2-14 S-curve acceleration/deceleration driving

In some motion cards, change position on the fly and change velocity on the

fly may be addressed specially (see Figure 2 -15 and Figure 2 -16). For example,

the end position of motor the user sets in the first place is 10000 pulses, but for some

reasons, the end position needs to be changed to 20000 pulses during the motion, the

function of change position on the fly can be used to meet such situation.

Figure 2-15 Change position on the fly

Advantech IAG Training Center (Internal Use Only)


24 Software Introduction (Advanced)

Figure 2-16 Change velocity on the fly

2.6 Interpolation

There are three types of interpolation, namely linear interpolation, circular

interpolation, and continuous interpolation which combines linear and circular

interpolation. The detailed description is shown as follows.

1. Linear interpolation

Interpolation is the approximation of some lines within a certain range. With this

function, users can adopt 2 or 3 or even more axes to draw line, circle or even a

helical line. The picture below shows a linear interpolation with error of 0.5LSB.

Advantech IAG Training Center (Internal Use Only)


References25

Figure 2-17 Linear interpolation

For a 2-axis interpolation, the controller can base on the commands to decide the

long axis and the short axis. The long axis moves with an average pulse train and the

short axis moves according to the long axis (see Figure 2 -18, XPP means X-axis

Pulse Plus and XPM means X-axis Pulse Minus).

Figure 2-18 The example for pulse output (X=20, Y=9)

2. Circular interpolation

For circular interpolation application, we can use circular to draw a circle, but

Advantech IAG Training Center (Internal Use Only)


26 Software Introduction (Advanced)

the precision is usually a little less than that of the linear interpolation.

Figure 2-19 Circular interpolation

Likewise, the 2-axis circular interpolation also uses the long and the short

axes to accomplish the task.

Advantech IAG Training Center (Internal Use Only)


References27

Figure 2-20 The example of pulse output in circular driving

3. Continuous interpolation

Continuous interpolation comprises a series of different interpolations. The

feature of continuous interpolation is that there is no acceleration and deceleration

between two interpolations. If users develop programs by themselves to run a path

like the right diagram of Figure 2-16, deceleration and acceleration can be expected at

each node. If users adopt the function of continuous interpolation, acceleration and

deceleration just happen in the beginning (start) and in the end (stop), the motor

moves with constant speed during the period of time.

Figure 2-21 Continuous interpolation

Advantech IAG Training Center (Internal Use Only)


28 Software Introduction (Advanced)

2.7 Position Compare

Not only the quality but also the efficiency of products are addressed in recent

years. For motion application, users always think how to increase the speed of

manufacturing, the function of position compare serves as a way to meet such

requirement. For example, the camera is required if users want to inspect the status of

ICs (see Figure 2 -22). In the past, the camera moves from point to point. That is to

say, the camera stops moving while arriving at a targeted point, and the actuator

enables the camera to take a picture, and then move the camera to next targeted

point.This way does waste some time on acceleration and deceleration. However,

when the function of position compare is adopted, the targeted points can be pre-

defined, so that the camera can base on the configuration to take pictures at a constant

speed without any stop.

Figure 2-22 Position compare application

Advantech IAG Training Center (Internal Use Only)


References29

2.8 Position Latch

The function of position latch can be used to detect the real position of certain

specific point. Figure 2 -23 gives an example, a sensor is installed at P006 of the die

saw machine. When the saw moves down to P006, the sensor sends the signal to the

motion module, so that the PC can recognize the difference between desired position

and real position.

Figure 2-23 Position latch application

About Homing and Limit functions, it will be introduced in Chapter 4 through hands

on practice.

2.9 Quiz

Advantech IAG Training Center (Internal Use Only)


30 Software Introduction (Advanced)

1. Please try to describe the architecture of motion control system and explain the

function of each part.

2. Please list down the advantage of stepping motors and servo motors.

3. There are three types of motor control, please describe them and note that these

controls are done with what signal (Pulse Command or Voltage Command).

4. Whats position control? Please try to define it.

5. Please explain the rule of three pulse command forms. (CW/CCW, , )

6. There are three types of pulse type signal, namely pulse/direction, CW/CCW,

and AB phase. Which type is mostly suitable in industrial application? Please

specify it and list down the advantage.

7. Please explain the S-curve speed profile.

8. There are three types of interpolation modes. Please illustrate them.

9. Whats the advantage of position compare? Please specify it.

10. Whats the advantage of position latch? Please specify it.

Advantech IAG Training Center (Internal Use Only)


References31

Chapter 3 Product Introduction

Generally speaking, motion control systems can be classified into two types

centralized and decentralized. The centralized motion control system was often

employed in the past, but when the machine size was getting bigger, it increased the

degree of the complexity of the centralized control system so as to raise the

maintenance effort. Consequently, the decentralized control system emerged. In this

section, the difference and comparison between centralized and decentralized control

systems will be introduced.

3.1 Centralized Motion Control System

The centralized motion control system is always adopted in the context of shorter

wiring distance and less motion axes. In general, one or few motion cards needs to be

inserted into one PC to comprise a centralized motion control system, the number of

axis depends on the amount of slots provided by the PC and the size of the plant is

concerned with the cable length. Here is an example of the centralized control system

which is shown in Figure 3 -24.

Advantech IAG Training Center (Internal Use Only)


32 Software Introduction (Advanced)

Figure 3-24 Centralized motion control system

This system includes several parts: PC, PC-based motion card, servo driver,

servo motor and sensors. The PC-based motion card is controlled directly by PCI bus

so that commands can be sent very fast. This structure tends to be selected for time-

concerned application. However, the PC needs to be fixed somewhere, that implies

the distance of the wiring between the PC and servo driver (or sensors) may be a

concern in the such system. For this reason, users may reduce the number of motion

axis to decrease the degree of the difficulty of the wiring.

3.2 Decentralized Motion Control System

Due to the advancement of communication technology, companies in relation to

Advantech IAG Training Center (Internal Use Only)


References33

motion automation start having a tendency to integrate the function of communication

into the motion control system, that is the turning point from the centralized to the

decentralized motion control system. Compared with the former, the latter can

overcome the distance problem by taking advantage of communication. AMONet,

developed by Advantech (not industrial standard), is a kind of communication

protocol and applied to the decentralized motion control system. It is a high speed RS-

485 communication and the speed can be up to 20MHz. The system diagram is shown

in Figure 3 -25.

Figure 3-25 Decentralized motion control system

The system includes master controller, slave modules, servo drivers, servo

motors, and sensors. Through AMONet, the master controller can manage all slave

modules and the wiring distance between the master and slaves can be more than

100m. Furthermore, one master controller can drive up to 64 slave modules. The

master controller can be a PCI or PC-104+ card, ADAM module or a built-in ring on

Advantech IAG Training Center (Internal Use Only)


34 Software Introduction (Advanced)

AMAX-2050KW, which is equipped with AMONet; the slave can be motion, DIO or

AIO modules. RJ-45 LAN cable can be used for AMONet communication and the

corresponding pin assignment is shown in Figure 3 -26.

Figure 3-26 AMONet pin assignmnet

According to the testing report, if users would like to connect up to 64 salve

modules in one ring shown in Figure 3 -27, the maximum distance could be 100m at

a speed of 10MHz.

Figure 3-27 Connection diagram

Another important thing users have to pay attention to is terminal resistor. If

more than one slave modules are connected in one ring, it is necessary to add the

Advantech IAG Training Center (Internal Use Only)


References35

terminal resistor in the last slave module to make sure the quality of communication.

About the switch setting, please see in Figure 3 -28.

Figure 3-28 SW1 and SW3 Switch setting

Due to the modularization of Advantech slave devices, it is more flexible for

users to deal with space issues, especially in large machine automation application.

Besides, there is one thing users need to note in relation to the decentralized motion

control system, that is the detection of communication failure. It is imperative to

become aware of disconnection caused by LAN cables (e.g., bad contact or broken) or

software programs (e.g., bugs). This feature in AMONet is called watchdog timer.

For more detail information, users can refer to the AMONet User Manual to know

how to ues it.

Advantech IAG Training Center (Internal Use Only)


36 Software Introduction (Advanced)

3.3 Product Selection Guide

After the introduction of centralized and decentralized motion control systems,

users should be able to realize the features of and the differences between these two

motion systems. Now, lets move on to Advantech motion-related product selection.

Roughly, the selection guide shown in Figure 3 -29 can be separated into two parts -

centralized and decentralized motion control systems.

Figure 3-29 Motion system structure

For the centralized solution, Advantech provides motion control cards, encoder

cards, and wiring boards which are listed in Table 3 -1. The customer can refer to this

table and choose proper products to meet their needs. The most popular motion

control card is PCI-1240U which is able to control stepping and servo motors through

Advantech IAG Training Center (Internal Use Only)


References37

pulse commands. It will be introduced in section 3.3.1.

Table 3-1 Advantech centralized motion control system solution


Motion Control Cards
PCI-1240U 4-axis Universal PCI Stepping/ P-type Servo Motor Control
PCM-3240 4-axis PC/104 Stepping/ P-type Servo Motor Control
PCI-1241* 4-axis PCI Stepping/ P-type & V-type Servo Motor Control
PCI-1242* 4-axis PCI Stepping/ P-type Servo Motor Control
PCI-1243* 4-axis Universal PCI Low Cost Stepping Motor Control
PCL-839+ 3-axis ISA Stepping Motor Control
Encoder Cards
PCI-1784U 4-axis Universal PCI Quadrature Encoder and Counter
PCL-833 3-axis Quadrature Encoder and Counter
Wiring Board
ADAM-3952 series PCI-1240U/PCM-3240 Wiring Terminal
(General, Mitsubishi J2S, Panasonic Minas A)
ADAM-3943* PCI-1243U Wiring Board with LED
Note: * means old products

For the decentralized solution, Advantech offers a variety of master controllers

and slave modules as well, please refer to Table 3 -2 for details.

Table 3-2 Advantech decentralized motion control system solution


AMONet Master Controller
PCI-1202U 2-port Universal PCI AMONet Master
PCM-3202P 2-port PC/104+ AMONet Master
AMAX-2050KW GX2-400 PC with AMONet Interface (1-port)
ADAM-5202 2-port ADAM AMONet Master
AMONet Motion Slave Module
AMAX-221X 1-axis Servo Motor Control
AMAX-224X 4-axis Servo Motor Control

Advantech IAG Training Center (Internal Use Only)


38 Software Introduction (Advanced)

AMONet Digital Input/Output Slave Module


AMAX-2730 8/8 ch Isolated Digital Input/Output AMONet Slave
AMAX-2750 series 32 ch Digital Input/Output AMONet Slave
AMONet Analog Input/Output Slave Module
AMAX-2710 12-bit 100kS/s 16-ch AI, 4-ch AO AMONet Slave

In terms of the naming rule of AMAX modules, it is a little bit complicated and

confused. The below table (see Figure 3 -30) arranged by AE should be able to give

you a clear picture about the naming rule of AMAX modules.

Figure 3-30 Naming rule of AMAX modules

In Section 4.3, users will know how to build up the communication between the

master controller and slave modules by using AMONet Device Manager, please go to

Section 4.3 if you would like to learn it immediately. On the other hand, since this

Advantech IAG Training Center (Internal Use Only)


References39

textbook is concerned with motion control, the DIO and AIO functions of slave

modules will not be introduced here. If you are interested in this part, please refer to

the textbook of Remote I/O for further understandings.

3.4 Centralized vs. Decentralized

In this section, the comparison between centralized and decentralized motion

control systems is made and shown in Table 3 -3.

Table 3-3 Comparison between centralized and decentralized


Centralized Decentralized
Operation System Windows 2000/XP, WinCE Windows 2000/XP, WinCE
Distance limitation 3-5m Up to 64 slave modules,
100m at a speed of 10MHz
Supported software Microsoft visual studio Microsoft visual studio,
Multiprog KW Multiprog KW
Throughput rate PCI bus and ISA bus speed Max. 20 MHz
Max supported axes Max. 64 axes in one type of card Max. 256 axes in one ring
Supported motor type Stepping and servo motors Stepping and servo motors
Control signal type Pulse, voltage Pulse

The major difference between these two systems is distance issue. For

centralized motion control system, the length of cable could be limited to 3-5m.

Accordingly, the space for computers/wiring boards and the size of entire motion

system need to be taken into account before planning and implementing. For

Advantech IAG Training Center (Internal Use Only)


40 Software Introduction (Advanced)

decentralized motion control system, motion modules can be installed far away from

the main computer or controller. Under such situation, the implementation of wiring

becomes easy and convenient, the arrangement of space in the whole motion control

system turns into flexible. Thats the main reason why the decentralized motion

control system emerges so fast in recent years.

3.5 Quiz

1. How many slave modules can an AMONET master ring connect up to? And

what is the maximal distance the decentralized motion solution can support?

2. If a user would like to install a lot of AMAX slave modules, what should be

noticed? Please specify them.

3. What should the transmission rate be if users adopt the maximal number of

AMAX slave modules with the maximal communication distance?

4. Suppose that a user tends to control 6 motors with 8 encoder feedback signals.

Please base on following products to come out a solution to meet above need.

PCI- 1240U: 4-axis servo motor control card

PCI-1243U: 4-axis stepping motor control card

PCI-1784U: 4-axis encoder card

5. According to the naming rule of AMAX modules, please try to explain what

AMAX-2242 mean.

6. If a user prefers to control the servo motor in velocity mode, what kind of

Advantech product is more suitable?

7. Suppose that a user just wants a PCI card with the function of encoder feedback

only. What products do you recommend?

Advantech IAG Training Center (Internal Use Only)


References41

8. Imagine to insert one motion control card into UNO-2170 so as to save space.

What motion card offed by Advantech could be a good choice in such context?

9. What AMAX slave modules can measure analog signal and output voltage?

10. Please specify the AMONet protocol.

Advantech IAG Training Center (Internal Use Only)


42 Software Introduction (Advanced)

Chapter 4 Getting Started

Nowadays, with the growth of technology, the speed of PC is getting faster and

faster. For this reason, there are more and more users use PC to be the master to

control one motion control system. For this advantage of graphic unit interface (GUI)

in PC, the operator can easy to know how to use the system through GUI Microsoft

Visual Studio, Borland C++ Builder, Delphi, and etc. in later sections, startup of

centralized motion control system, startup of Decentralized motion control system,

and how to use Advantech motion modules in Utility will be introduced.

4.1 Centralized Motion Control System

In this section, the steps of PCI-1240 utility will be introduced. Through these

following steps, users will be familiar with using PCI-1240U.

1. The centralized motion control system is shown in Figure 4 -31. For more

detailed information about pins wiring, please refer to the hardware manual.

Advantech IAG Training Center (Internal Use Only)


References43

Figure 4-31 Centralized motion control system

2. Please download the latest driver of PCI-1240U on the website

http://support.advantech.com.tw/support/default.asp. On the webpage, the user

will see PCI-1240.zip file which driver and utility are included is shown in

Figure 4 -32.

Figure 4-32 PCI-1240 driver and utility download website

3. After the installation, the software and PCI-1240 utility can be found at

Advantech IAG Training Center (Internal Use Only)


44 Software Introduction (Advanced)

StartProgramsAdvantech AutomationMotionPCI-1240.

4. Open PCI-1240 Utility which is shown in Figure 4 -33. It helps users to test its

installation and functionality. Also most of these settings can be done in the tool.

Figure 4-33 PCI-1240 Utility

5. Select Board ID first by Board Selection button, and the Board ID

configuration is decided on the card. It is shown in Figure 4 -34.

Advantech IAG Training Center (Internal Use Only)


References45

Figure 4-34 Board selection and PCI-1240U hardware Board ID configuration

6. Set parameter by clicking Parameter Setting, the Group 1 is for pulse output

configuration which is shown in Figure 4 -35. In this setting, user can configure

the pulse output type, acceleration mode, drive speed parameter, and etc.

Advantech IAG Training Center (Internal Use Only)


46 Software Introduction (Advanced)

Figure 4-35 Pulse output setting

7. Group 2 is for hardware input signal setting which is shown in Figure 4 -36. The

most important thing about group 2 setting is the alarm signal. If the alarm signal

is active, the servo driver will have alarm so that the motor will not move by any

command.

Advantech IAG Training Center (Internal Use Only)


References47

Figure 4-36 Hardware input signal setting

8. Group 3 is for the function of input and output pin configuration which is shown

in Figure 4 -37.

Advantech IAG Training Center (Internal Use Only)


48 Software Introduction (Advanced)

Figure 4-37 The function of input and output pin configuration

If some users would like to use compare function, the operation mode of output

must be configured to Driver Status Indicator . The hardware configuration of the

compare output pin OUT4 and OUT5 are listed in Table 4 -4.

Table 4-4 Jumper setting of JP10

Jumper JP10
The XOUT4 is defined as the pulse output XOUT4, Pin1 and Pin 2 short (Default)
channel for the incremental position compare
mechanism. And its open collector type output.
Its a design only for PCI-1240U. The position CMP, Pin2 and Pin 3 short
compare signal for both directions will output
from XOUT4, and the output level of XOUT4 is
TTL level.

Advantech IAG Training Center (Internal Use Only)


References49

9. Group4 is for encoder, software limit, and compare setting which is shown in

Figure 4 -38. The user also can set interrupt for many situations. In the encoder

setting, AB phase 1/1 Mode means 4X AB phase encoder mode.

Figure 4-38 Encoder, software limit and compare setting

10. Group 5 is home mode setting which is shown in Figure 4 -39. There are totally

7 homing types we can select. And the detailed information about each homing

type can be found in the PCI-1240U software manual.

Advantech IAG Training Center (Internal Use Only)


50 Software Introduction (Advanced)

Figure 4-39 Home mode setting

11. After the settings in the utility are done, the settings will be saved to registry

which is shown in Figure 4 -40. The user could export the registry to a file and

import it to other PC. Therefore, the configuration will be easy to get and

configure on other PC.

Advantech IAG Training Center (Internal Use Only)


References51

Figure 4-40 Registry of PCI-1240 configuration

12. Click Input Status button in the PCI-1240 Utility, there will be indicators and

statuses shown in Figure 4 -41. PCI-1240U provides 4 digital output channels

for each axis. But its not limited, so users can only use 1 axis and all 16 DO

channels at the same time. If the user wants to use one of the DO to do the servo

on, OUT6 of each axis is recommended. The status of digital input channels is

displayed in the Input Status. Among them, IN0 and IN3 are used for homing.

The external hardware signals for homing must be connected to these two pins.

In the bottom of the Input Status is the counter value, including the command

counter and the encoder feedback counter. Both values can be edited. The

compare value is also shown in it.

Advantech IAG Training Center (Internal Use Only)


52 Software Introduction (Advanced)

Figure 4-41 Input Status

Through the Drive End Status indicator, users can monitor the statuses of limit

switch, alarm, emergency. The emergency pin EMG, is an important function in

motion control application. The hardware setting is shown in Figure 4 -42, and it is

Advantech IAG Training Center (Internal Use Only)


References53

always used to be a button on machine to let the operator stop the motor immediately

for emergency situation.

Figure 4-42 EMG Pin on PCI-1240U

13. Click Operation button and the operation is shown as Figure 4 -43. After

configuration and check the input status, users can try to control the motor to

move by following steps:

a. Choose operation axes

b. Select the drive mode

c. Configure the drive speed or end position which depends on the drive mode

is set

d. Click start button

If users want to test the advanced functions such as linear interpolation and arc

interpolation, the utility is also supported. For more detail information about the

interpolation parameter setting please refer to the PCI-1240U software manual.

Advantech IAG Training Center (Internal Use Only)


54 Software Introduction (Advanced)

Figure 4-43 Operation window

14. Profile Monitor button can help users to monitor two axes moving on the map

and it is shown in Figure 4 -44. Users can know the path of the axes motion

through monitoring the map. With the help of Profile Monitor, the locus can be

checked by plotting a two-axis profile. In this tool, any two of the four axes in

the same card can be selected to be traced. Also, the speed profile can be

Advantech IAG Training Center (Internal Use Only)


References55

checked. Please note that the path is just for reference, the real path will depend

on the gear ratio, mechanism design, and etc.

Figure 4-44 Profile monitor

After the steps, users should know the basic function of PCI-1240 Utility. For

Advantech IAG Training Center (Internal Use Only)


56 Software Introduction (Advanced)

advanced functions, they will be introduced in section.

4.2 Practice for Centralized System

In this section, there will be some hands on practices for centralized and motion

control system. After these examples are done, the customer can learn more

experience for using Advantech motion products.

Use point to point function in PCI-1240 Utility such that the motor in X-axis

will move from position 0 pulse to position 10000 pulses in relative

coordinate.

1. Open the PCI-1240 Utility which is at StartProgramsAdvantech

AutomationMotionPCI-1240.

2. Check if the parameter setting which is shown in Figure 4 -45 is compatible

with the hardware setting in servo driver. About the servo driver setting, please

refer the hardware manual for it.

Advantech IAG Training Center (Internal Use Only)


References57

Figure 4-45 Parameter setting in PCI-1240 Utility

3. Make sure the signal is OK in Input Status window especially EMG and ALM

indicator and enable OUT6 of X-axis. (see Figure 4 -46)

Advantech IAG Training Center (Internal Use Only)


58 Software Introduction (Advanced)

Figure 4-46 Input Status

4. Click operation button, select X-axis, set point to point mode, and set the end

point to 10000. Remember that the movement mode should be set as relative

mode. (see Figure 4 -47)

Advantech IAG Training Center (Internal Use Only)


References59

Figure 4-47 Operation window

5. Click start button and the value of logical counter and feedback counter on the

input status window will be to 10000, the error will be 0. (see Figure 4 -48)

Advantech IAG Training Center (Internal Use Only)


60 Software Introduction (Advanced)

Figure 4-48 Position command and encoder feedback value

6. If the values of logical counter and real counter are not the same, please check if

the parameter setting is right again.

Use arc interpolation to let 2-axis motor move as a circle in PCI-1240 Utility

which center is (3000, 3000) and the end point is (6000, 6000) in the relative

coordinate.

1. Open the PCI-1240 Utility which is at StartProgramsAdvantech

AutomationMotionPCI-1240.

Advantech IAG Training Center (Internal Use Only)


References61

2. Check if the parameter setting which is shown in Figure 4 -49 is compatible

with the hardware setting in servo driver. About the servo driver setting, please

refer the hardware manual for it.

Figure 4-49 Parameter setting in PCI-1240 Utility

3. Make sure the signal is OK in Input Status window especially EMG and ALM

indicator and enable OUT6 of X-axis and Y-Axis. (see Figure 4 -49)

Advantech IAG Training Center (Internal Use Only)


62 Software Introduction (Advanced)

Figure 4-50 Input Status

4. Click operation button, select X-axis and Y-axis, set arc profile drive mode, set

C1, C2 to 3000, and set E1, E2 to 6000. Remember that the movement mode

should be set as relative mode. (see Figure 4 -51)

Advantech IAG Training Center (Internal Use Only)


References63

Figure 4-51 Operation window

5. Click start button and the input status window will show the counter value. (see

Figure 4 -52)

Advantech IAG Training Center (Internal Use Only)


64 Software Introduction (Advanced)

Figure 4-52 Input status window

6. The customer also can open the profile monitor to see the locus of two-axis

motion. (see Figure 4 -53) Users can configure the display parameter setting to

feed the suitable scale in two-axis coordinate.

Advantech IAG Training Center (Internal Use Only)


References65

Figure 4-53 Profile monitor

4.3 Decentralized Motion Control System

In Decentralized motion control system, master and slave is needed. In this

section, AMONet Device Manager Utility will be introduced and users can learn how

to use this utility in following steps:

1. The Decentralized motion control system diagram is shown in Figure 4 -54. For

more detailed information about pins wiring, please refer to the hardware

manual.

Advantech IAG Training Center (Internal Use Only)


66 Software Introduction (Advanced)

Figure 4-54 Decentralized motion control system diagram

2. Please download the latest driver of PCI-1202U on the website

http://support.advantech.com.tw/support/DownloadSRDetail.aspx?SR_ID=1-

1W8JTJ. On the webpage, the user will see AMONetDriver.zip file which

driver and utility are included is shown in Figure 4 -55. PCI-1202.exe file is

only for old version of PCI-1202.

Advantech IAG Training Center (Internal Use Only)


References67

Figure 4-55 PCI-1202U driver and utility download website

3. After the installation, the software and AMONet Device Manager utility can be

found at StartProgramsAdvantech AutomationAMONet Device Manager.

4. Open AMONet Device Manager which is shown in Figure 4 -56. Users will see

PCI-1202(X) master card and X means the board ID which range is 0~15.

Advantech IAG Training Center (Internal Use Only)


68 Software Introduction (Advanced)

Figure 4-56 AMONet Device Manager utility and hardware configuration of PCI-

1202U

5. Select PCI-1202U, baudrate setting and onboard DIO control will be shown as

Figure 4 -57. Please remember that the baudrate setting must be the same as the

slave modules.

Advantech IAG Training Center (Internal Use Only)


References69

Figure 4-57 Baudrate setting and onboard DIO control

6. Spread PCI-1202U and slave modules connected to master will be shown. Please

refer to Figure 4 -58, PCI-1202U has two rings and each ring could connect up

to 64 slave modules. Device IP is needed to distinguish each slave module.

Figure 4-58 AMONet Device Manager utility

7. For DIO slave modules shown in Figure 4 -59, the operation is very simple.

Users just check the LEDs of DI to know the status and clicking DOs to control

them.

Advantech IAG Training Center (Internal Use Only)


70 Software Introduction (Advanced)

Figure 4-59 DIO slave modules

8. For motion slave modules shown in Figure 4 -60, it could be separated in several

parts.

Figure 4-60 AMONet Device Manager utility

Advantech IAG Training Center (Internal Use Only)


References71

About the configuration and information of these parts will be described below.

a. Velocity Profile: to configure the distance, driving speed, acceleration, and

etc.

b. Speed Pattern: to decide the mode of Acc/Dec and there are T curve and S

curve mode to choose.

c. Configuration: it contains home mode setting, motion IO setting, and pulse

setting which are shown in Figure 4 -61, Figure 4 -62, and Figure 4 -63.

There are 13 modes for home mode setting, and users can refer to the

AMONet User Manual to know about the operation principle about homing.

Figure 4-61 Home mode setting

Advantech IAG Training Center (Internal Use Only)


72 Software Introduction (Advanced)

Figure 4-62 Motion IO setting

Figure 4-63 Pulse input/output mode setting

d. Motion Test: it contains move button, stop button, reset alarm (RALM), and

error counter clear (ERC). Users can control the motors through these

buttons

e. Position: through this frame, users can obtain the position command,

encoder feedback, and error. Due to the utility design, the range of error is

32768~32767.

f. Status: there are many indicators to let the users know the status about

Advantech IAG Training Center (Internal Use Only)


References73

motion slave modules.

About the definition of Abbreviations are listed in Table 4 -5.

Table 4-5 Definitions of Abbreviations


PCS Position Change Signal input (not supported at present)
EL End Limit, indicates the limit of motion in plus direction or minus direction
ORG Home signal input, indicates the origin of the system
SD Ramp-Down Signal Input
ALM Servo Alarm Signal
INP Servo In Position Signal
RDY Servo Ready Signal
LTC Position Latch Signal Input
EMG Emergency Stop Signal
ERC Clear Servo Error Counter Signal Output
RALM Reset the ALM status inside the servo driver
OUT Pulse Signal Output
EA Encode A Phase
EB Encode B Phase
EZ Encode Z phase
DIR Direction Signal Output
CMP Position Compare Output

9. Users also can use this utility to check the velocity profile shown in and know

get the speed curve of any movement.

Advantech IAG Training Center (Internal Use Only)


74 Software Introduction (Advanced)

Figure 4-64 Velocity profile monitor dialog

10. For advanced function of interpolation, only AMAX-224X slave modules are

supported. Users can select Multi-Axis Operation for linear and arc interpolation

and monitor the locus of two-axis motion. The GUI is shown in Figure 4 -65.

Advantech IAG Training Center (Internal Use Only)


References75

Figure 4-65 Advanced function of AMONet Device Manager utility

After going through these steps, users can roughly know the operation of

Advantech IAG Training Center (Internal Use Only)


76 Software Introduction (Advanced)

Decentralized motion control system in Advantech.

4.4 Pratice for Decentralized System

In this section, there will be some hands on practices for Decentralized motion

control system. After these examples are done, the customer can learn more

experience for using Advantech motion products.

Use point to point function in AMONet Device Utility such that the motor

will move from position 0 pulse to position 10000 pulses in relative

coordinate.

1. Open AMONet Device Manager Utility which can be found at

StartProgramsAdvantech AutomationAMONet Device Manager.

2. Select the motion slave module. In this example, AMAX-224X slave modules is

used. (see Figure 4 -66)

Advantech IAG Training Center (Internal Use Only)


References77

Figure 4-66 AMONet Device Manager Utility

3. Select the Single-Axis Operation tab window and configure motion IO and

input/output pulse type in configuration part to let all indicators to the normal

state. For the status definition, please refer to the software manual and hardware

manual. (see Figure 4 -67)

Advantech IAG Training Center (Internal Use Only)


78 Software Introduction (Advanced)

Figure 4-67 Configuration

4. Set move mode to P to P and distance to 10000 pulses. After settling done,

please remember to click Set parameters button to download these settings to

AMAX slave module.

5. Click right arrow button and the motor will move 10000 pulses in clockwise

direction. Users also can see the command value and feedback value will be

10000.

Advantech IAG Training Center (Internal Use Only)


References79

Figure 4-68 Point to point move

6. If there is error counter, please make sure the pulse configuration is the same as

the setting in servo driver.

Use arc interpolation to let 2-axis motor move as a circle in AMONet Device

Utility which center is (3000, 3000) and the end point is (6000, 6000) in

relative coordinate.

1. Open AMONet Device Manager Utility which can be found at

StartProgramsAdvantech AutomationAMONet Device Manager.

Advantech IAG Training Center (Internal Use Only)


80 Software Introduction (Advanced)

2. Select the motion slave module. In this example, AMAX-224X slave modules is

used. (see Figure 4 -69)

Figure 4-69 AMONet Device Manager Utility

3. Select the Single-Axis Operation tab window and configure motion IO and

input/output pulse type in configuration part to let all indicators to the normal

state. For the status definition, please refer to the software manual and hardware

manual. Since X and Y axes are needed, please remember to configure both axes

in this operation window. (see Figure 4 -70)

Advantech IAG Training Center (Internal Use Only)


References81

Figure 4-70 Configuration

4. After making sure two axes can work well, select the tab to Multi-Axes

Operation window.

5. Configure C1, C2 to 3000, E1, E2 to 6000, and click Arc button and the motors

will move to a half circle. (see Figure 4 -71)

Advantech IAG Training Center (Internal Use Only)


82 Software Introduction (Advanced)

Figure 4-71 Arc interpolation

6. Users can click path plot button to monitor the locus of axes motion which is

shown in Figure 4 -72.

Advantech IAG Training Center (Internal Use Only)


References83

Figure 4-72 Path plot monitor

If there is error counter, please make sure the pulse configuration is the same as

the setting in servo driver.

4.5 Hands on Exams

1. Please use AMAX-2212 to do continuous moving in both directions.

2. Please use PCI-1240U to do continuous moving in both directions.

3. Please modify the setting of AMAX-2212 to make the motor move with the

speed of 4500 PPS.

Advantech IAG Training Center (Internal Use Only)


84 Software Introduction (Advanced)

4. Please use PCI-1240U to control motors to move as a circle which center point is

(10000, 0) in relative coordinate.

5. Please us AMAX-2242 to control motors to move to the target point (40000,

30000) in relative coordinate.

6. Please use PCI-1240U to change the speed to 20000 PPS on the fly. (X-axis

motor)

7. Please try to use AMAX-2242 to draw a locus as shown below with linear

interpolation and circular interpolation. (Use AMONet Device Manager rather

than examples)

Advantech IAG Training Center (Internal Use Only)


References85

Advantech IAG Training Center (Internal Use Only)


86 Software Introduction (Advanced)

Chapter 5 Software Introduction

(Advanced)

In this chapter, the supported softwareMicrosoft Visual Studio, Nation

Instrument Labview software for centralized motion control system, KW Multiprog,

and SCADA software will be introduced. After going through this chapter, the users

can know the programming method with DLL driver and KW DLL driver.

Furthermore, a project can be created by some specific applications by themselves.

5.1 Programming Introduction

After introducing the startup of centralized and Decentralized motion control

systems, supposed that the users already know the based knowledge about the motion

control and can test the motors by Advantech motion utility. In advance, if they want

to develop their own program for the specific application, the way to know how to

develop the program by Advantech driver is necessary. For some users, they usually

use the PLC by ladder language to control the motors for their application. For such

application, PAC based controller which follows the IEC-61131-3 protocol can be

Advantech IAG Training Center (Internal Use Only)


References87

compatible with PLC. For other users, Advantech provides the DLL drivers which

support VB, VC++, BCB, Delphi, C#, VB.Net software. Advantech also provides the

library for Win CE so that the customers can develop the applications by EVC or .Net

programming software. In later sections, the programming of Microsoft Visual Studio,

Labview for centralized motion control system, and KW Multiprog will be

introduced.

5.2 Microsoft Visual Studio Introduction

In this section, the DLL programming for centralized and Decentralized motion

control system will be introduced.

5.2.1 DLL Programming for Centralized System

When the PCI-1240U driver is installed, the examples for PCI-1240U can be

found at the path: C:\Program Files\Advantech\Motion\PCI-1240\Examples. It

supports Borland C++ Builder, Delphi, Visual Basic 6.0, Visual C++ 6.0, and VS.Net.

In this section, the introduction of centralized DLL programming will be based on

Visual Basic 6.0 language since it is quite easy to let the users to understand the

programming. By the way, it is better to test motors in the PCI-1240 Utility first when

Advantech IAG Training Center (Internal Use Only)


88 Software Introduction (Advanced)

starting using motion examples.

When entering the VB folder, there will be four examples: BasicDrv,

CompTable, ContinueDrv, and RegisterFunc. Before introducing these examples,

knowing the flow chart of programming is very important. First of all, open the PCI-

1240U software manual and find the tutorial which is shown in Figure 5 -73.

Figure 5-73 PCI-1240U software manual

For example, for point to point movingbasic function, the flow chart is shown

in Figure 5 -74.

Advantech IAG Training Center (Internal Use Only)


References89

Figure 5-74 PTP flow chart

There are four steps to complete the PTP motion and the first step

P1240MotDevOpenand the last step P1240MotDevClose are necessary. These

two API function are shown in Figure 5 -75.

Advantech IAG Training Center (Internal Use Only)


90 Software Introduction (Advanced)

Figure 5-75 API function

After open PCI-1240U, some parameters must be set. Users can use

P1240MotAxisParaSet for parameter configuration and the function is shown in

Figure 5 -76.

Advantech IAG Training Center (Internal Use Only)


References91

Figure 5-76 P1240MotAxisParaSet

If users want to set the parameters of line or arc interpolation, just change the

value of bySetAxis parameter to 0. After configuring the parameters of Axes, PTP

Advantech IAG Training Center (Internal Use Only)


92 Software Introduction (Advanced)

moving can be used. For the PTP motion, there are three kinds of APIs to support this

moving action. It is listed in Table 5 -6.

Table 5-6 Point to Point motion


P1240MotPtp Force the assigned axis from current position to new position, for each axis
will move by their own speed parameters.
P1240MoveAbs Move one axis in absolute mode.
P1240MoveIns Move one axis in relative mode.

The mostly used one of the three PTP motion is P1240MotPtp, and its

description is shown in Figure 5 -77.

Advantech IAG Training Center (Internal Use Only)


References93

Figure 5-77 P1240MotPtp

Another important API function shown in Figure 5 -78 is P1240MotStop. This

function can stop the motor immediately or slow down the motor then stop.

Advantech IAG Training Center (Internal Use Only)


94 Software Introduction (Advanced)

Figure 5-78 P1240MotStop

Assuming the users already know the operation principle of PCI-1240U after

seeing the flow chart of Point to Point moving, below the example BasicDrv will be

introduced.

First of all, open the example and go to the form1 window and there will be the

main window for moving operation, it is shown in Figure 5 -79.

Advantech IAG Training Center (Internal Use Only)


References95

Figure 5-79 BasicDrv example

Some specific functions For PCI-1240U in the main window form will be

introduced below.

Select Board list:

The board ID of PCI-1240U is decided by the DIP switch on the


PCI-1240U.

Open Board button:

APIs P1240MotDevOpen, P1240MotAxisParaSet,


P1240MotRdMutiReg are used.

The API function P1240MotRdMutiReg can read many parameters like initial

speed, driving speed, acceleration, logical position counter, and etc. For the RRn and

WRn parameter of P1240MotRdMutiReg API function, users can refer to the MCX-

314 motion control IC manual to know the register definition.

Advantech IAG Training Center (Internal Use Only)


96 Software Introduction (Advanced)

Servo On button:

APIs P1240MotWrReg and P1240MotWrReg are used.

The API function of P1240MotWrReg is almost the same as that of

P1240MotWrReg. It is just write register and read register difference.

Close Board button:

P1240MotDevClose: close the specified PCI-1240U

Stop Button:

P1240MotStop: stop the motors immediately or slow down the


motors then stop

Single Axis Motion frame:

APIs P1240MotPtp, P1240MotCmove, and


P1240MotHome are used.

The API function P1240MotCmove is used to control the motors move

continuously in clockwise or counter clockwise direction. The detailed description is

shown in Figure 5 -80.

Advantech IAG Training Center (Internal Use Only)


References97

Figure 5-80 P1240MotCmove

The API P1240MotHome is used to control the motors to find the home sensor.

About the homing function, PCI-1240U supports totally 7 home types which are

shown in Figure 5 -81.

Advantech IAG Training Center (Internal Use Only)


98 Software Introduction (Advanced)

Figure 5-81 P1240MotHome

Interpolation frame:

APIs P1240MotLine and P1240MotArcTheta are used.

In this frame, if the selected axes are less than 2 axes, the operation will be

inhibited. The API function P1240MotLine is used to control the 2 or 3 axis motors to

do line interpolation and its description is shown in Figure 5 -82. This API can be set

motors to move in absolute or relative coordinate.

Advantech IAG Training Center (Internal Use Only)


References99

Figure 5-82 P1240MotLine

P1240MotArcTheta is used to control 2 axis motors to move arc interpolation.

The description and detailed information is shown in Figure 5 -83.

Advantech IAG Training Center (Internal Use Only)


100 Software Introduction (Advanced)

Figure 5-83 P1240MotArcTheta

Timer Component:

Advantech IAG Training Center (Internal Use Only)


References101

P1240MotRdMutiReg: read the logical position counter and driving


speed periodically

After viewing these functions in the BasicDrv example, users will know the

operation process of the DLL programming more clearly.

Another advanced example is ContinueDrv which is used to control the motors

to move a path including line and arc interpolation. Users also can refer to the flow

chart in the PCI-1240 manual.

Advantech IAG Training Center (Internal Use Only)


102 Software Introduction (Advanced)

Figure 5-84 Flow chart and application window of Continue Move

Before moving a path, allocate and initial the path data buffer is needed. Users

can use the API P1240InitialContiBuf to allocate memory for path data and the

description of this API function is shown in Figure 5 -85.

Advantech IAG Training Center (Internal Use Only)


References103

Figure 5-85 P1240InitialContiBuf

The size of the path data buffer depends on the PC memory and can be set up to

232 32 bytes. Normally it is enough to use. After allocating the buffer, users can use

P1240SetContiData to put the path data to the path data buffer for movement. When

moving the path, users can get the current movement path data sequence number

through P1240GetCurContiNum to know the process. The description is shown in

Figure 5 -86.

Advantech IAG Training Center (Internal Use Only)


104 Software Introduction (Advanced)

Figure 5-86 P1240GetCurContiNum

After completing every moving in the desired path, please remember to use API

P1240FreeContiBuf to release the memory.

There are still a lot of programming flow chart and examples for PCI-1240U.

Users can refer to the PCI-1240 manual to know more about this card. If there are still

any problems about programming, please call the service center: 0800-557-799. There

will be application engineers to solve your problems.

5.2.2 DLL Programming for Decentralized System

After installing the AMONet Device Manager, the examples for AMAX series

modules can be found at the path: C:\Program Files\Advantech\AMONet\Examples. It

supports Borland C++ Builder, Delphi, Visual Basic 6.0, Visual C++ 6.0, and VS.Net.

In this section, the introduction of Decentralized DLL programming will be based on

Advantech IAG Training Center (Internal Use Only)


References105

Visual Basic 6.0 language since it is quite easy to let the users to understand the

programming. By the way, it is better to test motors in the AMONet Device Manager

first when starting using motion examples.

The operation principle between PCI-1240 and AMONet is totally different. For

this reason, DLL programming of Decentralized motion system will be not the same

as that of centralized motion system. In this section, DLL programming on PCI-

1202U will be introduced and step by step to describe the motion functions in more

detail.

The PCI-1202U is a Standard AMONet PCI-Bus Interface Master Card. There

are two NPMG9001A chips on board. Each chip controls one ring.

Figure 5-87 PCI-1202U

First of all, open the master card PCI-1202U and start ring. The flow chart is

shown in Figure 5 -88. Note that in the below calling flow, _1202_open can only

be used by PCI-1202U. For other devices, the function is substituted by

_mnet_initial (which also supports PCI-1202U).

Advantech IAG Training Center (Internal Use Only)


106 Software Introduction (Advanced)

Figure 5-88 Open master card and start ring

When opening the example, there will be two buttons which are shown below to

represent open card and start ring.

Open and initial master card

Start ring

After these two configurations, slave IO modules such as AMAX-2750 series

and AMAX-2710, it can be controlled. But for slave motion modules, like AMAX-

2240 series, users must use Axis Init button shown below to configure the motion

modules.

Advantech IAG Training Center (Internal Use Only)


References107

Make sure the configuration is done and then click SVON button to let the servo

motor servo on.

Next, set a trapezoidal velocity and S-curve velocity profile by clicking Set

speed button.

Advantech IAG Training Center (Internal Use Only)


108 Software Introduction (Advanced)

The STOP button is used to control the motor slow down to stop.

ERC (clear servo error counter signal output) and RALM (reset the ALM

status inside the servo driver) buttons are for specific application.

After introducing the essential API functions in all examples, below the

examples for AMAX-2240 series slave motion modules will be described. The basic

example AMAX2240_Motion is used to control one axis to do continuous moving.

Advantech IAG Training Center (Internal Use Only)


References109

The form is shown in Figure 5 -89.

Figure 5-89 AMAX2240_Motion

The arrow buttons control the direction of the motor moving and the code of

Visual Basic is shown below.

The Advanced example, AMAX2240_Motion_Path, uses the memory of the

Advantech IAG Training Center (Internal Use Only)


110 Software Introduction (Advanced)

AMAX-2240 to plan the path. The form window is shown in Figure 5 -90.

Figure 5-90 AMAX2240_Motion_Path

The _mnet_m4_set_fw_memory function will be used.

Advantech IAG Training Center (Internal Use Only)


References111

Figure 5-91 Firmware setting

Set Speed Profile button sets a T-Curve or S-Curve velocity profile for path

buffer movement. In the same path move, T-Curve and S-Curve path function cannot

be executed in turn.

Advantech IAG Training Center (Internal Use Only)


112 Software Introduction (Advanced)

Set Line Data and Set Arc Data buttons can be set the line and arc data to the

path buffer. Users choose the performed axes and related function, e.g. if selecting XY

plane, only those related axes functions can be adopted. The path buffer can store

1000 paths (from 0 to 999) and it acts like a First In First Out (FIFO). Users can check

current values and buffer status using the function

_mnet_m4_get_path_status.Path buffer is designed as a ring-buffer. Once

AMAX-224x finish one path, the space in Path buffer will be released. The user

can keep pushing new path commands into AMAX-224x when

FreeSpaceCount(Note1) > 1. In the same path motion, all the executed-Axis is

fixed by first path command. For example, The first path command uses both the X-

axis and Y-axis, then the following path command can use X-axis and Y-axis only.

Advantech IAG Training Center (Internal Use Only)


References113

The freespacecount is read by _mnet_m4_get_path_status API function which is

defined in Figure 5 -92. In the DLL programming, timer component is usually used to

monitor the path status.

Figure 5-92 Get path status

When path data is settle done, users can click Start path to start motor motion.

Advantech IAG Training Center (Internal Use Only)


114 Software Introduction (Advanced)

For Decentralized motion system, users worry about the quality of

communication. If there are some disturbances such as LAN cable disconnect and

noise, it will cause the communication error. For this purpose, AMONet protocol has

the watch dog function to monitor the status of communication. Advantech provides

the WatchDog example which is shown in Figure 5 -93 that can protect the

machine from damaging because of communication error.

Figure 5-93 WatchDog example

Advantech IAG Training Center (Internal Use Only)


References115

_mnet_set_ring_quality_param API function is to set the ring's continue error

and error rate. Please see below.

Name Type Description


RingNo U16 Ring number. Each ring of the master device is assigned an exclusive
ring number.

ContinueErr U16 Range 1~0xffff

ErrRate U16 Error counter per 1k rounds

_mnet_get_com_status API function is used to monitor the communication

status. There are four statuses shown below.

Name Description
ERROR_NoError The API returns success

ERROR_Invalid_Ring Make sure the Ring is active

Return Value Communication Status


Value Meaning
00 Ring disconnected
01 Ring connect
02 Slave error
03 Ring is stopped

Before the watchdog in the ring is triggered, a communication error will occur. After

meeting special conditions, (defined by the function mnet_set_ring_quality_param,)

the watchdog will be triggered. To find the slave module which suffered a

communication error and caused communications to fail, we can use the

mnet_get_error_device. function. This function returns the ID number of the slave

module that triggers the watchdog. The programmer should pay attention to two

Advantech IAG Training Center (Internal Use Only)


116 Software Introduction (Advanced)

things. mnet_get_error_device should be used when a communication error occurs.

We can use the function mnet_get_com_status to know whether theres error in the

ring. When it returns Slave Error, we can then use the mnet_get_error_device

function to find the module that is having a communication error.

The function mnet_get_error_device only returns the smallest slave ID number

among all slave modules that have suffered communication errors. For instance,

consider the following four configurations where three AMONet slave modules,

having slave IDs 4, 5 and 6, are connected in one ring.

A. The connection is Master ID=4 ID=5 ID=6.

When ID=4 has communication error, mnet_get_error_device returns 4.

When ID=5 has communication error, mnet_get_error_device returns 5.

When ID=6 has communication error, mnet_get_error_device returns 6.

B. The connection is Master ID=5 ID=6 ID=4.

When ID=5 has communication error, mnet_get_error_device returns 4.

When ID=6 has communication error, mnet_get_error_device returns 4.

When ID=4 has communication error, mnet_get_error_device returns 4.

C. The connection is Master ID=5 ID=4 ID=6.

When ID=5 has communication error, mnet_get_error_device returns 4.

When ID=4 has communication error, mnet_get_error_device returns 4.

When ID=6 has communication error, mnet_get_error_device returns 6.

D. The connection is Master ID=4 ID=6 ID=5.

Advantech IAG Training Center (Internal Use Only)


References117

When ID=4 has communication error, mnet_get_error_device returns 4.

When ID=6 has communication error, mnet_get_error_device returns 5.

When ID=5 has communication error, mnet_get_error_device returns 5.

Therefore, to make sure which device has the communication error, connect the

AMAX slave modules in device IP turn is very important.

There are still a lot of API functions not introduced. Users can refer to the

AMONet Drivers Manual to see what function they want to use or call the service

center to ask help.

5.3 Labview for Centralized Motion Control

There are many users using Labview to develop their applications. For this

reason, Advantech also develop the Labview driver for PCI-1240U. This driver can be

downloaded in the Advantech website.

After installing it, the examples can be found at the path: C:\Program

Files\National Instruments\LabVIEW 8.X\examples\Advantech Motion. The example

ContiDrive which is used to control the motors moving by path planning is shown

in Figure 5 -94.

Advantech IAG Training Center (Internal Use Only)


118 Software Introduction (Advanced)

Figure 5-94 ContiDrive example

The operation principle between the DLL programming and Labview in

Centralized motion system is almost the same. For example, the flow chart of

Advantech IAG Training Center (Internal Use Only)


References119

continue move shown in Figure 5 -95 is the same as that in DLL programming. Users

can refer to the programming tutorial in Advantech Motion Vis Labview Manual to

develop their own program.

Figure 5-95 Continue move flow chart

Through this Labview driver for centralized motion control system, users can

develop their applications in Labview more conveniently.

Advantech IAG Training Center (Internal Use Only)


120 Software Introduction (Advanced)

5.4 Introduction of MultiProg KW

MultiProg KW, one kind of software, is used to develop the PAC programming.

PAC stands for Programmable Automation Controller, and it combines the features of

PC and PLC. Therefore, users can use PAC to do many applications. It can do the

complicated calculation and can combine the SCADA software to do more convenient

and friendly graphic unit interface.

PAC also follows IEC-61131-3 protocol which defines the protocol of the

software and hardware in PLC. For this advantage, users can replace PLC by PAC

without learning a new programming tool. IEC-61131-3 supports five languages. In

this textbook, only function blocks of motion in MultiProg KW will be introduced. If

users are interested in the this software, please refer to PAC textbook and there will be

more information and advanced function to be introduced.

5.5 Multiprog KW Programming of Motion

In this section, the Multiprog KW programming in motion system will be

introduced.

Advantech IAG Training Center (Internal Use Only)


References121

5.5.1 Basic Configuration of Multiprog KW

Figure 5 -96 shows the PAC solution in Advantech.

Figure 5-96 PAC solution

AMAX-2050KW, the most popular master controller in PAC motion control, has

WinCE operating system and can be developed the motion applications in KW. For

this reason, many users utilize it to implement the Decentralized motion system by not

only WinCE programming but also Multiprog KW. This section will focus on how to

develop the KW program using AMAX-2050KW master controller and AMAX slave

motion modules.

First of all, create a new project for WinCE system like below.

Advantech IAG Training Center (Internal Use Only)


122 Software Introduction (Advanced)

Figure 5-97 Create a project

Double click Advantech_DAQ and add the motion module AMAX-2240.

Advantech IAG Training Center (Internal Use Only)


References123

Figure 5-98 Add AMAX motion module (1)

Configure the AMAX-2240 and set baud rate which is compatible with the

hardware setting. The Board ID should be also the same as the Device IP of AMAX

slave modules which range is from 0 to 63.

Advantech IAG Training Center (Internal Use Only)


124 Software Introduction (Advanced)

Figure 5-99 Add AMAX motion module (1)

Configure the axis settings such as pulse output mode, pulse input, alarm input,

and etc.

Advantech IAG Training Center (Internal Use Only)


References125

Figure 5-100 configuration

If for DIO and AIO modules, remember to click Create All Input Variables

button to generate the global variables.

Advantech IAG Training Center (Internal Use Only)


126 Software Introduction (Advanced)

Figure 5-101 AMAX I/O slave modules

After creating the new project and configuring the AMAX slave modules, users

can connect the PC and AMAX-2050KW through Ethernet and the setting is shown in

Figure 5 -102. When the state on Project Control Dialog is on, it means the KW on

PC connects the ProConOS on AMAX-2050KW. For more detail setting and

functions, users can refer to the PAC textbook.

Advantech IAG Training Center (Internal Use Only)


References127

Figure 5-102 Use DLL and set the AMAX-2050KW IP address

5.5.2 Motion Function Introduction of Multiprog KW

The following diagram shown in Figure 5 -103 defines the behavior of the axis

when multiple motion control function blocks are simultaneously activated.

Advantech IAG Training Center (Internal Use Only)


128 Software Introduction (Advanced)

Figure 5-103 Axis state diagram

This combination of motion profiles is useful in building a more complicated

profile to handle exceptions within a program. The basic rule is that motion

commands are always taken sequentially, even if the PLC had the capability of real

parallel processing. These commands act on the axis state diagram. The axis is always

in one of the following states: Disabled, StandStill, Stopping, ErrorStop, Homing,

DiscreteMotion and ContinuousMotion. The state Disabled is the initial state of

each axis. In this state, any movement has no effect. Only if Enable of MC_Power is

TRUE, the state leads to StnadStill without any axis error. Otherwise, the state leads

to ErrorStop. If Enable of MC_Power is FALSE, the state is transited to Disabled.

Advantech IAG Training Center (Internal Use Only)


References129

During this period, there still exist some function blocks not finished. All of them are

aborted forcibly. The intention of the state ErrorStop is that the motion of the axis is

stopped. Once the state is transited to ErrorStop, all function blocks without

completion are aborted forcibly. New motion command is accepted until MC_Reset

has been done. MC_Stop aborts any motion command and change the state to

Stopping. The state Stopping is kept as long as Execute of MC_Stop is TRUE. In

this state, no another motion command can abort. The following administrative

function blocks have no effect on the state of the axis: MC_ReadParameter,

MC_ReadBoolParameter, MC_WriteParameter,

MC_ReadStatus,MC_ReadAxisError , MC_WriteBoolParameter, and

MC_ReadActualPosition. There are some notes listed below.

1. Enable of MC_Power is TRUE and there is no error

2. Enable of MC_Power is TRUE but there is an error

3. In both states ErrorStop and Stopping, any function block is not allowed to

be executed except MC_Power if Enable is FALSE

4. Done of MC_Stop is TRUE and Execute of MC_Stop is FALSE

Below I will introduce some basic motion functional blocks by one simple

example.

MC_Power_A1: This function block commands to control the power stage

(on/off). Whatever the motor type is, it should be enabled so that the motor can

Advantech IAG Training Center (Internal Use Only)


130 Software Introduction (Advanced)

do other motion action.

MC_Stop_A1: This function block commands a controlled motion stop. It can

abort any ongoing motion.

MC_Home_A1: This function block commands the axis to perform to search

home. The position is used to set the absolute position when the reference signal

is detected.

These graphical representations of the three function blocks are shown in Figure

5 -104. Please keep in mind that Enable pin means level active and Execute pin

means edge trigger active.

Figure 5-104 Graphical representations

MC_Read_Status_A1: This function block returns in detail the status of the

specified axis with respect to the motion currently in progress.

MC_ReadParameter_A1: This function block returns the value of a specified

parameter.

Advantech IAG Training Center (Internal Use Only)


References131

The parameter number table is listed below.

Parameter Parameter Name Data Variable Read Description


Number Type Type /Write
1 CommandPosition REAL B R Command position
2 SWLimitPos REAL E R/W Positive software limit
switch position
3 SWLimitNeg REAL E R/W Negative software limit
switch position
4 EnableLimitPos BOOL E R/W Enable positive software
limit switch
5 EnableLimitNeg BOOL E R/W Enable negative software
limit switch
6 EnablePositionLagMonitoring BOOL E R/W Enable monitoring of
position lag
7 MaxPositionLag REAL E R/W Maximal position lag
8 MaxVelocitySystem REAL E R Maximal allowed
velocity of axis setting in
the driver dialog
9 MaxVelocityAppl REAL B R/W Maximal allowed
velocity of axis in the
application
10 ActualVelocity REAL B R Actual velocity
11 CommandVelocity REAL B R Command velocity
12 MaxAccelerationSystem REAL E R Maximal allowed
acceleration of axis
setting in the driver
dialog
13 MaxAccelerationAppl REAL E R/W Maximal allowed
acceleration of axis in the
application
14 MaxDecelerationSystem REAL E R Maximal allowed
deceleration of axis

Advantech IAG Training Center (Internal Use Only)


132 Software Introduction (Advanced)

setting in the driver


dialog
15 MaxDecelerationAppl REAL E R/W Maximal allowed
deceleration of axis in the
application
16 MaxJerk REAL E R/W Maximal allowed jerk of
axis in the application

MC_ReadActualPosition_A1: This function block returns the actual position.

These graphical representations of the three function blocks are shown in Figure 5

-105.

Figure 5-105 Graphical representations

MC_MoveRelative_A1: This function block commands a controlled motion of a

Advantech IAG Training Center (Internal Use Only)


References133

specified distance relative to the actual position at the time if execution.

MC_MoveAbsolute_A1: This function block commands a controlled motion to a

specified absolute position.

MC_MoveVelocity_A1: This function block commands a never ending

controlled motion at a specified velocity.

MC_MoveAdditive_A1: This function block commands a controlled motion of a

specified relative distance additional to the most recent commanded position in

the discrete motion. It is not allowed that the function block is actually executed

if axis state is ContinuousMotion.

These graphical representations of the four function blocks are shown in Figure 5

-106.

Advantech IAG Training Center (Internal Use Only)


134 Software Introduction (Advanced)

Figure 5-106 Graphical representations

Using these function block which is introduced above, users can try to control

one axis motor for single moving.

5.5.3 Advanced Motion Function of Multiprog KW

In order to control multi-axis motor motion, advanced motion function blocks are

needed. In this section, multi-axis moving, advanced homing, and path planning

function blocks will be introduced.

Advantech IAG Training Center (Internal Use Only)


References135

MC_StepAbsSwitch_A1: This function block performs a homing function by

searching for an absolute positioned external physical switch. When it is done,

the axis state is still in Homing, not transited to StandStill.

MC_FinishHoming_A1: This function block transfers the axis state from

Homing to StandStill without any movement.

MC_StepDirect_A1: This function block performs a static homing function by

directly forcing an actual position without physical motion. When it is done, the

axis state is transited from Homing to StandStill.

MC_StepRefPulse_A1: This function block performs a homing function by

searching for zero pulse in encoder. When it is done, the axis state is transited

from Homing to StandStill.

The example of advanced homing function blocks are shown in Figure 5 -107.

Figure 5-107 Advanced homing function

For line and arc interpolation, the relative function blocks are introduced below.

Note that if users want to use interpolation function, adding axes in one group is

Advantech IAG Training Center (Internal Use Only)


136 Software Introduction (Advanced)

necessary. First of all, adding and removing group function are listed below.

MC_AddAxisToGroup_A1: This function block adds one axis to a group. It has

actual effect only when the group is not busy.

MC_RemAxisFromGroup_A1: This function block removes one axis from a

group. It has actual effect only when the group is not busy.

MC_UngroupAllAxes_A1: This function block removes all axes from a group. It

has actual effect only when the group is not busy

Next, there are some function blocks can read the group status. It is listed below.

MC_GpReadStatus_A1: This function block returns status parameter of a group.

MC_GpReadActualPos_A1: This function block returns the actual position of a

group.

MC_GpReadActualVel_A1: This function block returns the actual position of a

group.

MC_GpReset_A1: This function block makes the transition from the state

GroupErrorStop to GroupStandBy by resetting all internal group-related errors.

MC_ReadGpError_A1: This function block describes general group errors

making state transfer to GroupErrorStop.

The example of adding axes in one group are shown in Figure 5 -108.

Advantech IAG Training Center (Internal Use Only)


References137

Figure 5-108 Group function blocks

Third, after adding axes in one group, users can use line and arc interpolation

function blocks.

MC_MoveLinearAbs_A1: This function block commands an interpolated linear

movement to absolute end positions for each dimension.

MC_MoveLinearRel_A1: This function block commands an interpolated linear

movement to relative distances for each dimension.

MC_MoveDirectAbs_A1: This function block command a interpolated linear

motion to absolute end positions for each dimension without taking care of how

the position is reached.

MC_MoveDirectRel_A1: This function block Command a interpolated linear

motion to relative distances for each dimension without taking care of how the

position is reached.

MC_MoveCircleAbs_A1: This function block commands an interpolated circle

motion to absolute end position for each dimension.

MC_MoveCircleRel_A1: This function block commands an interpolated circle

Advantech IAG Training Center (Internal Use Only)


138 Software Introduction (Advanced)

motion to position for each dimension. The positions are defined relatively to the

according positions of the starting point.

MC_GpStop_A1: This function block commands a controlled motion stop and

transfers the axis group to the state GroupStopping. It aborts any ongoing

motion.

Here is a linear interpolation example shown in Figure 5 -109.

Figure 5-109 Linear interpolation

For the data type of the Distances pin, it should be set as an array. Users can

define the array in Data types like below.

Advantech IAG Training Center (Internal Use Only)


References139

Figure 5-110 Array definition

The last one is path planning. Users can save the path data in the path editor and

then execute the path. The path data also can be exported to an Excel file.

Advantech IAG Training Center (Internal Use Only)


140 Software Introduction (Advanced)

Figure 5-111 Path editor

The multi axis motors will move by the path. The speed profile of the path only

has acceleration in the starting and deceleration in the end. It will maintain the

constant driving speed during moving.

MC_GpPathSelect_A1: This function block loads a path with specified path ID

(ID = 1 or 2).

MC_GpMovePath_A1: This function block commands a continuous

interpolation movement with specified path.

Advantech IAG Training Center (Internal Use Only)


References141

After setting the path data, users just use two function blocks to move path.

Figure 5-112 Path planning function blocks

Another important function block which is mostly used in motion application is

TP function block.

Figure 5-113 TP function block

This function block can help users to do cyclic motion moving. Here is an

example shown below and it shows the way to control one axis motor moves CW to

CCW periodically.

Advantech IAG Training Center (Internal Use Only)


142 Software Introduction (Advanced)

Figure 5-114 cyclic moving example

For more detail description about every motion function block, users can refer to

the Advantech DAQ KW Driver Manual.

5.6 KW and SCADA Integration

After introducing the Multiprog KW, we can combine the Decentralized motion

control system and SCADA software to let operator easy to control the machine

through Graphic User Interface. Here is an example shown in Figure 5 -115. It

contains AMAX-2050KW, TPC-660E, EKI-2525P, AMAX-2242, and servo motors.

AMAX-2050KW is used to be the AMONet master controller and the ProConOS

server is included. TPC-660E is a touch panel computer and the SCADA software is

bundled. EKI-2525P is a 5-port Industrial Unmanaged PoE Ethernet Switch and

supports redundant power input. AMAX-2242 is a 4-axis AMONet RS-485 Motion

Slave Module for Mitsubishi MR-J2S and it is used to control two axes servo motors

in this application. I modify the KW program in my laptop and download it to the

Advantech IAG Training Center (Internal Use Only)


References143

AMAX-2050KW and develop the SCADA program into the TPC-660E. the

Modbus/TCP protocol is used and EKI-2525P is used to communicate AMAX-

2050KW and TPC-660E through Ethernet.

Figure 5-115 Architecture of motion system

The GUI of SCADA software is shown in Figure 5 -116. Start button controls

the motors do homing motion and then enable the specific motion action buttons:

HOME, SPIRAL, MOVE, and Circle. The indicators PosZ and PosU can monitor the

logical position counter of motors from the AMAX-2242.

Advantech IAG Training Center (Internal Use Only)


144 Software Introduction (Advanced)

Figure 5-116 SCADA example

After seeing this application, users can know it is easy to develop it even though

they are only familiar with the PLC programming.

5.7 Quiz

1. Please modify try to modify ContinueDrv example of PCI-1240U to do the path

planning as shown below.

Advantech IAG Training Center (Internal Use Only)


References145

2. Please try to modify AMAX2240_Motion_Path example of AMONet which

contains PTP, homing function, and path planning.

3. Modify AMONet WatchDog example to be able to show what module is

disconnected.

4. Create a Project to use 2-Axes Line and Arc interpolation to complete a path

shown below and add 3-Axes Line Interpolation function from (0,0,0) to (5000,

10000,4500)

5. Please use MultiPorg KW to connect AMAX-2050KW to control AMAX-2241 to

do PTP and advanced home move function.

6. Please use MultiPorg KW to connect AMAX-2050KW to control AMAX-2241 to

do Linear and circular interpolation.

7. Please use MultiPorg KW to connect AMAX-2050KW to control AMAX-2241 to

Advantech IAG Training Center (Internal Use Only)


146 Software Introduction (Advanced)

read the actual position and current status in X-Axis. (Hint: MC_Read_Status_A1)

8. Please use MultiPorg KW to connect AMAX-2050KW to control AMAX-2241 to

do path planning shown below.

Advantech IAG Training Center (Internal Use Only)


References147

References

[1] R. L. Andersson, Computing the Feasible Configurations of a 7-DOF Arm

Subject to Joint Limits, IEEE Transactions on Robotics and Automations, Vol.

9, No. 2, pp. 186-195, 1993.

[2] A. M. Anthony, Dealing with the Ill-Conditioned Equations of Motion for

Articulated Figures, IEEE Computer Graphics and Applications, pp. 63-71,

May 1990.

[3] A. M. Anthony, Dealing with the Ill-Conditioned Equations of Motion for

Articulated Figures, IEEE Computer Graphics and Applications, pp. 63-71,

May 1990.

Advantech IAG Training Center (Internal Use Only)

S-ar putea să vă placă și