Example - start motion on switch, Examples - input interrupt, Special labels – Yaskawa LEGEND-MC User Manual

Page 344: Examples - input interrupt special labels

Advertising
background image

334

LEGEND-MC User’s Manual

Example - Start Motion on Switch

Motor X must turn at 4000 counts/sec when the user flips a panel switch to on. When panel switch is
turned to off position, motor X must stop turning.

Solution: Connect panel switch to input 1 of LEGEND-MC. High on input 1 means switch is ON.

Examples - Input Interrupt

Special Labels

This program demonstrates five of the SPECIAL LABELS as part of a LEGEND-MC application
program. #AUTO is usually the first line of a program. When this program is burned into the LEGEND-
MC using the BP command, the program will begin executing when the power is turned ON or after the

Instruction

Interpretation

#S;JG 4000

Set speed

AI 1;BGX

Begin after input 1 goes high

AI -1;STX

Stop after input 1 goes low

AMX;JP #S

After motion, repeat

EN;

#A

Label #A

II 1

Enable input 1 for interrupt function

JG 30000,-20000

Set speeds on X and Y axes

BG XY

Begin motion on X and Y axes

#B

Label #B

TP XY

Report X and Y axes positions

WT 1000

Wait 1000 milliseconds

JP #B

Jump to #B

EN

End of program

#ININT

Interrupt subroutine

MG "Interrupt has occurred"

Displays the message

ST XY

Stops motion on X and Y axes

#LOOP;JP #LOOP,@IN[1]=0

Loop until Interrupt cleared

JG 15000,10000

Specify new speeds

WT 300

Wait 300 milliseconds

BG XY

Begin motion on X and Y axes

RI

Return from Interrupt subroutine

Advertising