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 />

Jumps and calls:<br />

We make the difference between jumps and calls. When you want to go from<br />

one point in your block to another point within the same block, then you use a<br />

jump command. If you want to go from one block ( COB, PB, FB, or SB ) to<br />

another block, then you use a call the block.<br />

Another important difference is that if you call a block then the system will<br />

execute the called block and will then return to point where the block was<br />

called from. A jump doesn't return.<br />

WARNING: Jumps are potentially dangerous. This is because you can<br />

end up programming programs with endless loops. Therefore never ever<br />

jump backwards in a program.<br />

Jump instructions<br />

JR Jump relative<br />

JPD Jump direct<br />

JPI Jump indirect<br />

Block calls:<br />

CPB Call program block<br />

CPBI Call program block indirect<br />

CFB Call function block<br />

CSB Call Sequential block<br />

Unconditional<br />

jumps and calls:<br />

If you don't add a condition to your jump or call, then they will be done every<br />

time the program execution arrives to the jump instruction.<br />

COB 0<br />

0<br />

COB 0<br />

0<br />

PB 3<br />

JR<br />

Lablename<br />

CPB 3<br />

CPB 4<br />

PB 4<br />

Lablename:<br />

EPB<br />

EPB<br />

ECOB<br />

ECOB<br />

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

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

Saved successfully!

Ooh no, something went wrong!