Until recently, programming and the integration of controls and motion components usually required several programming languages. Ladder logic was used for the control logic of a PLC and for the code to communicate to the motion controller and the operator interface. Motion commands were typically RS-274D (G codes), programmed in C or in a language defined by the control manufacturer. And the language used for the operator interface was vendor proprietary.

Now, though, engineers no longer have to use three languages. The motion and control industries are moving to a single, common language referred to as flow chart programming. Available from a handful of vendors, this software is intuitive to use, self-documenting, and it lets engineers add diagnostic routines as needed without rewriting a program.

Several companies would like it to become a sixth language in the IEC-1131 standard for industrial control programming languages. This possibility will be discussed in future meetings of the PLCopen association, which supports and promotes this standard.

Cooperative relationships

As PC-based motion control gained acceptance over the last few years, motion and software vendors saw an opportunity to cooperate and develop the next step — integrated motion and control. Companies such as Motion Engineering Inc. have engineering teams creating motion profiles using the C language. Engineers embed these profiles into digital signal processors (DSPs), then put the DSPs onto multi-axis motion controller cards. The flow chart programs access these profiles using motion calls, such as Move X to 6, or Move to advance position, and so on. The C code for the motion side is hidden from the end users, who have only to fill in appropriate parameters when prompted.

Motion functions handled by flow chart programs include single and multiaxis motion; independent or coordinated moves such as linear, arc, and circular; master-slave motion; position-triggered motion; jogging; blending; and several profiles including S-curve, trapezoidal, and parabolic.

Motions not suitable, depending on the application, are those that require special functions, such as tool wear, tool offsets, and other compensation functions. In addition, highly precise multiaxis metal cutting applications are better programmed with a dedicated CNC or a motion card with CNC capabilities. In some cases, you can integrate such a motion card with a flowchart program as long as memory information is mapped between the program and the card. Parameters, start and stop signals, and status messages can transmit through a dual-port RAM interface. Remote CNCs can use an input-output (IO) interface that allows the same functions.

Flow chart elements

Like another graphic-based language, Sequential Function Chart (SFC) or Grafcet, flow charts use graphic elements to describe a sequence of actions. However, SFC as defined in the IEC-1131 standard is not intended to be a complete programming language. Rather, it is a way of organizing the sequential activity of ladder logic programs. It consists of steps and transitions, Figure 1. Each step is a reference to an underlying program written in a different language. Transitions move the execution from one step to another.

Flow charts use action blocks and decision diamonds, elements that engineers, programmers, operators, and electricians are familiar with. In most such programs, engineers drag and drop these elements into place, according to the needed sequence of events. Arrows link the elements. Programming statements, such as Advance pushbutton, Move to advance position, Axis motion complete?, are placed in the blocks and diamonds. In place of plain English statements, some flow charts let engineers use fill-inthe blank calls, which can make motion commands as easy as A to B. Others have engineers enter parameters for axis, position, acceleration and deceleration rates, and velocity.

When the flow chart encounters a motion action block during execution, the block generates a call to the motion card and passes any associated parameters, Figure 2. Special instructions known as software drivers and the motion profile software translate the parameters into executable code. The motion card receives this code and parameters and executes the motion. When finished, it may pass parameters back to the flow chart program.

The flow chart requires no additional logic outside of the motion call block and no need to create diagrams that show memory addresses or memory allocations (mapping) as in a PLC system.

The method of interface between the flow chart and the motion card differs among vendors. Some use Windows or one of the new real-time versions of Windows NT. Others use separate software, sometimes called a real-time engine, that functions independently of other operating systems in the controller. As Windowsbased operating systems can experience unexpected downtime, which interface you choose depends on your application’s tolerance for such a possibility.

Because the motion card usually plugs into the backplane of the PC, communication is done over the backplane bus. This eliminates the delays often encountered when initiating motion commands over an IO network. DSP-based motion cards still close servo loops.

Continue on page 2

The name game

Flow charts solve a major headache for programmers — that of multiple databases for the names, or tags, of IO points, timers, arrays, PID loops, and so on. Previous languages required engineers to use a separate database for each group of tags for control, motion, and operator- to-machine interface. Flow chart programs reduce the number of needed databases to one.

The tags, Figure 2, show floating point motion parameters, as well as internal storage points, which can be integer, ASCII floating point, or bits. The IO to the motion card transmits floating point variables, such as position, velocity, acceleration and deceleration rates. This capability differs from traditional PLC programs where IO points do not directly relate to a motion function.

The tags are accessed inside flowchart elements. Programmers do not have to be C literate or know the programming language of the motion card. And they can reuse flow chart sequences because all fields are tags. Once engineers are satisfied with a flow chart, they substitute parameters for tag names. If ten conveyor lines operate in the same manner, for example, engineers need only write one sequence of code and test it once. They then arrange the program to call that sequence ten times, each time passing tags associated with a particular conveyor to the parameters.

Flow charts let separate action sequences run in parallel, Figure 3. This is useful for calling functions that check status or monitor such user-initiated signals as E-stop and others. In addition, engineers can split cumbersome code into concise sections, which shortens programming time because sections are reusable.

Flow charts also solve common documentation problems (such as insufficient or indecipherable documentation) because the programming statements are in English and the chart shows the steps in the process.

Diagnostics are easy to implement. Users can create diagnostic loops and exception- handling blocks that will constantly monitor system status. Engineers select the needed flow chart elements, link them into a sequence, then link the sequence into the desired portion of the flow chart.

Lastly, the program executes faster than a typical ladder program, as not all the logic in a flow chart is scanned every pass and PCs generally have fast CPU speeds. If a part of the process is not active, it’s not scanned.

Standard programming languages

The IEC-1131 standard helps bring order out of PLC programming chaos. This standard consists of five parts: General information, specifications for equipment and test requirements, specifications for programming languages, user guidelines, and communications.

The section on programming languages defines two graphical languages — ladder diagram and function block diagram — and two text-based languages — instruction list and structured text. Each language also uses an organization language commonly known as Sequential Function Chart. This language helps organize the sequences of functions in a PLC program.

Ladder diagram logic is the oldest PLC language and the one most electricians and maintenance engineers know. Instruction list is similar to assembler language for computers. For simple applications, it executes only one operation per line. Structured list offers Boolean and arithmetic statements as well as statements that use IF, THEN, ELSE and WHILE commands. It can be used to represent analog and digital values. The function block language defines code that is common to several applications or repeated in several segments of a program. An example of a function block is PID loop control.

The goal of IEC-1131 is to empower programmers to use any one or all five languages in one PLC program. The flow chart language could become the sixth language specified in this standard.

Mike Messick is Senior Applications Engineer at Steeplechase Software Inc., Ann Arbor, Mich.