Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 14 of 50

Festo Software Tools: Statement list and Ladder diagram for SF 3, FST 200 Manual, pages 131 to 140

Pages 131 to 140 of 496

The original document is the PDF (3.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the Festo FPC-202

Page 131

FST 200-STL

F 3

LOAD

4. Programming in the statement list

This instruction is used to read a register or a multibit operand, i.e. its value is written in the multi-bit accumulator. This instruction is generally followed by the word TO. It indicates the target of this operation. Example: THEN

F 4

TO

LOAD TO

V500 TP31

This instruction is used to assign a value to a word operand. TO always specifies the target of this operation. Example: THEN

LOAD TO

V100 R6

Register 6 is loaded with value 100. F 5

JMP TO

This instruction causes a jump in your program to a specified step. Example: STEP Label IF THEN SET JMP TO ... ... STEP Start ...

I1.0 O1.0 Start

The program jumps to the Start step label and the program is continued there. IF, OTHRW and STEP have already been described in section 4.3.1.

9610a

4-35

Page 132

FST 200-STL

4. Programming in the statement list

4.3.4 Extended functions You access the extended functions by selecting function F4 in the STL Editor menu or function F5 in the STL commands. Use these functions to enter instructions for multi-bit operands in your STL program.

Fig. 4.12: Extended functions F 1

4-36

SWAP

The most significant byte is swapped with the least significant byte and vice versa in the multi-bit accumulator.

9610a

Page 133

FST 200-STL

4. Programming in the statement list

The content of the multi-bit accumulator, which consists of 16 bits, is to be distributed over the 8-bit output words OW0 and OW1. Since the least significant byte (8 bits) is always read first from the accumulator, the accumulator would be empty for the next TO operation. It is therefore necessary to use SWAP to swap the most significant byte with the least significant byte. Example: THEN

F 2

SHL

V$55AA OW0 OW1

Shift to the left. This instruction shifts the content of the multi-bit accumulator one bit position to the left. The free right-hand position is filled with a zero. This means a multiplication by 2. Calling the SHL instruction three times consecutively, this would mean a multiplication by 2x2x2, i.e. by 8. Example: THEN

9610a

LOAD TO SWAP TO

LOAD SHL TO

V16 R7

4-37

Page 134

FST 200-STL

F 3

SHR

4. Programming in the statement list

Shift to the right. This instruction shifts the content of the multi-bit accumulator one bit position to the right. The free left-hand position is filled with a zero. This means a division by 2. Just as with SHL, multiple shifting means a division by 2 each time. Example: THEN

4-38

LOAD SHR TO

V16 R7

F 4

ROL

This instruction has the same effect as SHL with the difference that the most significant bit is pushed to the left out of the accumulator and is pushed back in as an overflow to the right as the least significant bit.

F 5

ROR

As with SHR, the bits of the multi-bit accumulator are shifted to the right. Here, however, the right-hand bit is popped from the accumulator and transferred as the most significant bit.

9610a

Page 135

FST 200-STL

F 6

BID

4. Programming in the statement list

This instruction converts the content of the multi-bit accumulator from binary notation to BCD notation. You may use BCD code to trigger LEDs in displays, for example. Example: THEN

F 7

DEB

9610a

IW0 OW7

On this instruction, all the bits in the multi-bit accumulator are converted from BCD to binary code. This is necessary if you have connected to an input of your controller a BCD switch, the switching state of which is to be adopted by the input word and then processed in a counter. Example: THEN

F STL 8 commands

LOAD DUD TO

LOAD DED TO

IW7 CW7

This returns you to the STL commands as illustrated in Fig. 4.9.

4-39

Page 136

FST 200-STL

4. Programming in the statement list

4.3.5 Further instructions In addition to the instructions which you may call through the function keys, you may also use the keyboard • To enter comments • To enter instructions internal to the program • To enter mathematical functions. Comment There are two ways in which you can enter comments in your STL program: • Short comments with a maximum of 36 characters may be appended to a program line. These are introduced with a quotation mark. Example: IF N

I1.7

"Sensor not assigned

• Long comments may be entered in a complete line. These are introduced with double quotation marks. Example: IF N I1.7 ""The sensor is not assigned here

4-40

9610a

Page 137

FST 200-STL

4. Programming in the statement list

Instructions internal to the program Enter these instructions by typing them in. They are not assigned to function keys. You may use the following instructions here: CFMn, CMPn, Pn, PSE, SHIFT, INC, DEC, and the special functions CPL and INV. These instructions are explained in appendix A.1.1 (List of operations). Mathematical functions In addition to the instructions referred to above, the following mathematical operations are available: (, ), +, -, *, /, <, <=, =, >=, >, <>. You may use these to program arithmetic operations and comparisons. Example: IF

THEN

( = ) AND ( <> ) ...

FW0 V1234

R1 V0

With these instructions you must take account of whether and for which expressions you have to use brackets. It can easily happen that the logical structure is not correct because of incorrect brackets or the absence of brackets.

9610a

4-41

Page 138

FST 200-STL

4. Programming in the statement list

4.3.6 Indexed programming The word operands IW, OW, R, FW, TP, TW, CP and CW can be addressed by index. This means that the content of one of the index registers X or Y is interpreted as an operand number. The address for the word operand is determined at runtime and is restricted to the valid address range for this operand. This means that if values are given of, for instance, x = 1 and y = 33, the flag word FW1 is addressed both times by the expression FW[x] or FW[y]. Example: STEP THEN

Init (1) LOAD V4 TO X LOAD V10 TO Y =================================== STEP IF

(2) X < V16 THEN LOAD Y TO R [X] ZV X ZV Y JMP TO SetRegs (2) OTHRW NOP ========================================= STEP (3)

4-42

SetRegs

9610a

Page 139

FST 200-STL

4.4

4. Programming in the statement list

Timers and counters Some additional notes are required for programming these functions, as these functions are not simple query or set instructions. This section deals with the details necessary for entry in an STL program. You will find technical details regarding timers and counters in the description of the programmable valve terminal with SF 3 control block.

4.4.1 Programming timers Timers are used to form a timer element. You can implement pulse timers in an STL program. Using these as a basis you have the facility to program waiting times, monitoring times and switch-on or switch-off delays. Expired timers may be used several times in a step program. A timer is a one-bit operand. It may be set, reset and queried. Each timer has: • A timer status (Tnn) • A timer preselection (TPnn) • A timer word (TWnn)

nn is the timer number. 32 timers are available (0-31).

9610a

4-43

Page 140

FST 200-STL

4. Programming in the statement list

Timer status The timer status indicates whether the timer is active or inactive. The values for this are: Tnn=0 Tnn=1

Timer is inactive (stopped or expired) Timer is active (it is running down)

The timer status Tnn is a one-bit operand. It may be set, reset and queried. The timer status is not remanent. Timer default Enter the running time of the timer in the timer default. Valid values lie in the range from 0.00s to 655.35s in 0.01s increments. The timer default is remanent. Timer word The timer word is is the instantaneous value of the timer. It is not remanent. Initialize timer When a timer is initialized, the content of the timer default is loaded into the timer word. This value constitutes the initial value.

4-44

9610a