Programming 2. programming – Lenze E94P PositionServo with MVOB User Manual

Page 34

Advertising
background image

32

L

PM94H201B_13xxxxxx_EN

Programming

2.

Programming

2.1

Program Structure

One of the most important aspects of programming is developing the program’s structure. Before writing a program, first
develop a plan for that program. What tasks must be performed? And in what order? What things can be done to make
the program easy to understand and allow it to be maintained by others? Are there any repetitive procedures?

Most programs are not a simple linear list of instructions where every instruction is executed in exactly the same order
each time the program runs. Programs need to perform different functions in response to external events and operator
input. SML contains program control structures and scanned event functions that may be used to control the flow of
execution in an application program. Control structure statements are the instructions that cause the program to change
the path of execution. Scanned events are instructions that execute at the same time as the main body of the application
program.

Header - Enter in program description and title information
;********************************* HEADER *********************************

;Title:

Pick and Place example program

;Author: Lenze

;Description:

This is a sample program showing a simple sequence that

;

picks up a part, moves to a set position and drops the part

I/O List - Define what I/O will be used
;********************************* I/O List ******************************

;

Input A1

-

not used

;

Input A2

-

not used

;

Input A3

-

Enable Input

;

Input A4

-

not used

;

Input B1

-

not used

;

Input B2

-

not used

;

Input B3

-

not used

;

Input B4

-

not used

;

Input C1

-

not used

;

Input C2

-

not used

;

Input C3

-

not used

;

Input C4

-

not used

;

;

Output 1

-

Pick Arm

; Output

2 - Gripper

;

Output 3

-

not used

;

Output 4

-

not used

Initialize and Set Variables - Define and assign Variables values
;**************************** Initialize and Set Variables *****************

UNITS = 1

ACCEL = 75

DECEL =75

MAXV = 10

;V1 =

;V2 =

DEFINE Output_on 1

DEFINE Output_off 0

Advertising