1 initiating a program, 2 halting and resuming a program, Initiating a program -25 – ElmoMC SimplIQ Software Manual User Manual

Page 87: Halting and resuming a program -25

Advertising
background image

SimplIQ

Software Manual

Program Development and Execution

MAN-SIMSW (Ver. 1.4)

6-25

6.6.1

Initiating a Program

A program is initiated by the XQ command, which indicates at which label execution should
begin.

The XQ command does not reset program variables; initial values for all variables

must be set by the user.

The XQ command clears the call stack, kills any pending automatic routines and clears the
interrupt mask. For a description of the XQ command, refer to

section

6.7.1

.

6.6.2

Halting and Resuming a Program

The HP Interpreter command can be used to stop execution of the user program and the
automatic routines. HP freezes the status of the program and does not reset it. A later XC
command can resume the program from the instruction at which the program was halted.
Pending interrupts will remain pending.

Example 1:

MO=1;

Start

motor.

JV=2000;

Set jog speed.

##LOOP;

Repetitive task

BG;

wait(1000)

Wait and switch direction.

JV=-JV;

goto##LOOP;

Repeat.

This program indicates that the motor should travel at 2000 counts/second for one second,
then reverse direction for one second, and then continue to travel back and forth forever.

If the HP command is applied when the program is waiting (executing the wait(1000)
instruction), the motor will continue to travel at the same direction for an unlimited time.

An XC command reverses the direction immediately, because the waiting time has already
elapsed.

Example 2:
A servo axis in a machine has two different tasks to perform, in two different machine
modes. The following routine implements the two tasks.

##TASK1;

##LOOP;

Repetitive task 1.

Task 1 body.

goto##LOOP;

Repeat task 1.

##TASK2;

##REP;

Repetitive task 2

Task 2 body.

goto##REP;

Repeat task 2.

Advertising