7 application programming, Introduction, Program format – Yaskawa LEGEND-MC User Manual

Page 291: Valid labels, Invalid labels, 1square, Application programming, Introduction program format

Advertising
background image

281

LEGEND-MC User’s Manual

7 Application Programming

Introduction

The LEGEND-MC programming language is a powerful language that allows users to customize a
program to handle their application. Complex programs can be downloaded into the LEGEND-MC
memory for later execution. Utilizing the LEGEND-MC to execute sophisticated programs frees the host
computer for other tasks. The host computer can still send commands to the controller any time, even
while a program is being executed.

In addition to standard motion commands, the LEGEND-MC provides commands that allow the
LEGEND-MC to make its own decisions. These commands include conditional jumps, event triggers,
and subroutines. For example, the command JP#LOOP, N<10 causes a jump to the label #LOOP if the
variable N is less than 10.

For flexibility, the LEGEND-MC provides 254 user-defined variables, arrays and arithmetic functions,
i.e.; length in a cut-to-length operation can be specified as a variable in a program and assigned by an
operator.

The following sections in this chapter discuss all aspects of creating applications programs.

Program Format

A LEGEND-MC program consists of several LEGEND-MC instructions combined to solve a machine
control application. Action instructions, such as starting and stopping motion, are combined with
Program Flow instructions to form the complete program. Program Flow instructions evaluate real-time
conditions, such as elapsed time or motion complete, and alter program flow accordingly.

A delimiter must separate each LEGEND-MC instruction in a program. Valid delimiters are the
semicolon (;) or carriage return. The semicolon is used to separate multiple instructions on a single
program line. A carriage return enters the final command on a program line.

All LEGEND-MC programs must begin with a label and end with an End (EN) statement. Labels start
with the pound (#) sign followed by a maximum of seven characters. The first character must be a letter;
after that, numbers are permitted. Spaces are not permitted.

The maximum number of labels that may be defined is 126.

Valid labels

#BEGIN

#SQUARE

#X1

#BEGIN1

Invalid labels

#1Square

#123

Advertising