Jump functions depending on status bits

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 573 - 576)

STL provides jump functions with which the assignment of the status bits (BR, CC0, CC1, OV, OS) can be evaluated. An overview of the combinations which can be scanned and the jump functions is provided in Table 14.3 on Page 568.

Scanning of the status bits is possible in LAD and FBD, and it is possible to program a conditional jump function JMP or JMPN dependent on these (see Chapter 14.1.5

“Evaluating the status bits” on page 566).

Jump functions JBI and JBIN dependent on binary result (STL)

The jump function JBI is only executed if the binary result is “1” when this function is processed. The jump is not executed if the binary result is “0” and execution of the program is continued with the following statement.

The jump function JBIN is only executed if the binary result is “0” when this func- tion is processed. The jump is not executed if the binary result is “1” and execution of the program is continued with the following statement.

JBI and JBIN terminate a binary logic operation; a new logic operation starts follow- ing the jump function or at the jump destination. The RLO is retained and can be evaluated using a memory function following the jump function.

Jump functions JZ, JN, JP, JPZ, JM, JMZ, and JUO (STL)

The jump functions dependent on the status bits CC0 and CC1 do not change any status bits. The result of logic operation is “carried over” with the jump and can be linked further (no change in /FC).

The jump function JZ is only executed if the status bits are CC0 = “0” and CC1 = “0”.

This is the case if:

b The content of accumulator 1 is zero following an arithmetic or math function b The content of accumulator 2 is equal to the content of accumulator 1 with a

comparison function

b The content of accumulator 1 is zero following a word logic operation b The value of the last shifted-out bit is “0” following a shift function

The jump function JN is only executed if the status bits CC0 and CC1 have different signal states. This is the case if:

b The content of accumulator 1 is not zero following an arithmetic or math function

b The content of accumulator 2 is not equal to the content of accumulator 1 with a comparison function

b The content of accumulator 1 is not zero following a word logic operation b The value of the last shifted-out bit is “1” following a shift function

The jump function JP is only executed if the status bits are CC0 = “0” and CC1 = “1”.

This is the case if:

b The content of accumulator 1 is within the permissible positive numerical range following an arithmetic or math function (you scan for violation of the numeri- cal range using JO or JOS)

b The content of accumulator 2 is greater than the content of accumulator 1 with a comparison function

b The content of accumulator 1 is not zero following a word logic operation b The value of the last shifted-out bit is “1” following a shift function

The jump function JPZ is only executed if the status bit CC0 = “0”. This is the case if:

b The content of accumulator 1 is within the permissible positive numerical range or zero following an arithmetic or math function (you scan for violation of the numerical range using JO or JOS)

b The content of accumulator 2 is greater than or equal to the content of accumu- lator 1 with a comparison function

b Following every word logic operation b Following every shift function

The jump function JM is only executed if the status bits are CC0 = “1” and CC1 = “0”.

This is the case if:

b The content of accumulator 1 is within the permissible negative numerical range following an arithmetic or math function (you scan for violation of the numeri- cal range using JO or JOS)

b The content of accumulator 2 is less than the content of accumulator 1 with a comparison function

The jump function JMZ is only executed if the status bit CC1 = “0”. This is the case if:

b The content of accumulator 1 is within the permissible negative numerical range or zero following an arithmetic or math function (you scan for violation of the numerical range using JO or JOS)

b The content of accumulator 2 is less than or equal to the content of accumulator 1 with a comparison function

The jump function JUO is only executed if the status bits are CC0 = “1” and CC1 =

“1”. This is the case if:

b Division is by zero with an arithmetic function

b An invalid REAL number has been specified as input value or is produced as result

Jump functions JO and JOS (STL)

A program branch can be executed depending on the status bits OV and OS. In this case you scan whether the result of a calculation is still within the permissible numerical range.

The jump function JO (jump if overflow) is only executed if the status bit OV is set to “1”. This is the case if the permissible numerical range has been left following execution of an operation. The following functions can set the status bit OV:

b Arithmetic functions b Math functions

b Generation of two's complement

b Comparison functions with REAL numbers

b Conversion functions INT or DINT to BCD and REAL to DINT

If the status bit OV = “0”, JO continues execution of the program with the next state- ment.

In the case of a chain calculation with several operations executed in succession, the status bit OV must be executed following each calculation function since the next calculation whose result is in the permissible numerical range resets OV again.

Scan the status bit OS in order to evaluate a possible numerical range overflow at the end of the chain calculation.

The jump function JOS (jump if overflow stored) is only executed if the status bit OS is set to “1”. This is always the case is a numerical range overflow sets the status bit OV (see above). In contrast to OV, OS remains set if the result is subsequently in the permissible numerical range.

The following functions reset OS again:

b Block call and block end b Jump if stored overflow JOS

If the status bit OS = “0”, JOS continues execution of the program with the next statement.

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 573 - 576)

Tải bản đầy đủ (PDF)

(747 trang)