B.5 sequence programs, A-19 – Yaskawa MP2000 Series: User's Manual for Motion Programming User Manual

Page 340

Advertising
background image

App

B Sample Programs

A-19

B.5 Sequence Programs

In this sample program, sequence programs are used for JOG and STEP operation of servomotor with single axis.

Sequence main program (SPM001)

Sequence subprogram (SPS002)

"SPM001: Main program"

SSEE SPS002; "Settings common to all axes
SSEE SPS003; "JOG & STEP operation process
END;

"SPS002: Settings common to all axes"

"---------------------------------------
" Motion command 0 (No command) detection
"---------------------------------------
IF IW8008 == 0;
MB300010 = 1;
ELSE;
MB300010 = 0;
IEND;

"---------------------------------------
" Servo ON command
"---------------------------------------
OB80000 = MB300000 & (IB80000 | IB80002); "Servo ON

"---------------------------------------
" Alarm reset
"---------------------------------------
OB8000F = MB300001; "Alarm reset

"---------------------------------------------------------------------------
" Speed unit & Acceleration/deceleration unit selection
"
" Bit 0 to 3: Speed unit selection (0: reference unit/s, 1: Reference unit/min., 2: Designated in %)
" Bit 4 to 7: Acceleration/deceleration unit selection (0: Reference unit /s

2

, 1: ms)

"---------------------------------------------------------------------------
DW00010 = OW8003 & FF00H; "Function setting 1 work
OW8003 = DW00010 | 0011H; "Function setting 1

"---------------------------------------
" Linear acceleration/deceleration setting
"---------------------------------------
IF MB300020 == 1;
OL8036 = 100; "Linear acceleration rate/Acceleration time constant
OL8038 = 100; "Linear deceleration rate/Deceleration time constant
IEND;

RET;

The Servo turns ON when

MB300000 turns ON.

Advertising