07.03.2014 Views

Introduction.

Introduction.

Introduction.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Workshop PG5<br />

Instructionlist<br />

Conditional<br />

jumps and calls:<br />

Jumps and calls can contain a condition code. A condition code is a flag which<br />

( depending on it's state ) executes a call or a jump. There are different condition<br />

codes.:<br />

1. You can activate a jump or a call depending on the state of the ACCU.<br />

Example: If you use the condition code H, then the instruction will be<br />

executed only if the ACCU is high ( equal 1 ). Condition code L executes<br />

the instruction if the ACCU is low.<br />

2. Another way to influence the behaviour of your program are the arithmetic<br />

flags Negative, Positive, Zero, and Error. All the arithmetic instructions<br />

and some of the communication instructions alter the state of the four flags.<br />

The booklet with the instruction set summary, lists all the instructions and indicates<br />

which of these instructions alter the ACCU or the arithmetic flags.<br />

Examples:<br />

We want to stop the acceleration of<br />

the motor once the speed is, equal to<br />

or higher than 200. Therefore we<br />

compare the speed with 200. If the<br />

value in the register called Motor<br />

speed is equal or higher than 200,<br />

then the Positive flag is set after the<br />

CoMPare instruction.<br />

The Jump Relative instruction checks<br />

the Positive flag and jumps over the<br />

program part which normally accelerates<br />

the motor.<br />

In this example we have a surveillance<br />

flag which is used somewhere else in<br />

the program. As soon as this flag is<br />

set ( flag content equals 1 ) we want to<br />

call the Program Block named Alarm.<br />

The STart High instruction sets the<br />

ACCU to 1 if the content of the surveillance<br />

flag is 1. The Call Program<br />

Block instruction on the next line<br />

checks the ACCU and calls the Program<br />

Block named Alarm as soon as<br />

the ACCU is High.<br />

MotorSpeed equ R<br />

MinimumSpeed equ 200<br />

COB 0<br />

0<br />

CMP<br />

MotorSpeed<br />

MinimumSpeed<br />

JR P NoAcceleration<br />

~<br />

~<br />

NoAcceleration:<br />

~<br />

~<br />

ECOB<br />

Surveillance equ F<br />

Alarm equ PB<br />

COB 0<br />

0<br />

STH Surveillance<br />

CPB H Alarm<br />

ECOB<br />

PB Alarm<br />

EPB<br />

PG5-07-E © Saia-Burgess Controls Ltd. Page 7-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!