
Chapter 7 Application Programming
Overview
The DMC-40x0 provides a powerful programming language that allows users to customize the controller for their
particular application. Programs can be downloaded into the DMC-40x0 memory freeing the host computer for
other tasks. However, the host computer can send commands to the controller at any time, even while a program
is being executed. Only ASCII commands can be used for application programming.
In addition to standard motion commands, the DMC-40x0 provides commands that allow the DMC-40x0 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 greater programming flexibility, the DMC-40x0 provides user-defined variables, arrays and arithmetic functions.
For example, with a cut-to-length operation, the length can be specified as a variable in a program which the
operator can change as necessary.
The following sections in this chapter discuss all aspects of creating applications programs. The program memory
size is 80 characters x 4000 lines.
Program Format
A DMC-40x0 program consists of DMC 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.
Each DMC-40x0 instruction in a program must be separated by a delimiter. Valid delimiters are the semicolon (;) or
carriage return. The semicolon is used to separate multiple instructions on a single program line where the
maximum number of instructions on a line is limited by 80 characters. A carriage return enters the final command
on a program line.
Using Labels in Programs
All DMC-40x0 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 in label.
The maximum number of labels which may be defined is 510.
Valid labels
#BEGIN
#SQUARE
Chapter 7 Application Programming ▫ 117
DMC-40x0 User Manual