Navigation:  Equipments (Devices) > SCA06 > Ladder > Math > Math Extended >

ROUND

Previous pageReturn to chapter overviewNext page

Block that rounds the value of Value, storing the result in Result.

 

Ladder Representation

 

ROUND_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value

REAL

Reference variable for the operation

VAR_OUTPUT

Done

BOOL

End of operation

Result

REAL

Variable that stores the result of the operation

 

Operation

 

When this block has a TRUE value in EN, it sends to the Result output the rounded value of Value. If no errors, the Done variable is set. If there is any error in the operation, Done is not set, staying in FALSE status, while Result remains with its value unchanged.

 

When EN has FALSE value, Result remains unchanged and Done remains in FALSE.

 

Compatibility

 

Device

Version

PLC300

2.10 or higher

SCA06

2.00 or higher

 

Block Flowchart

 

ROUND_flowchart

 

Example in Ladder

 

ROUND_example01

 

The above example rounds the value of the VALUE variable, storing the final result in RESULT. Decimals less than 0.5 are discarded. The block ends with success and Done output is activated.

 

ROUND_example02

 

The above example rounds the value of the VALUE variable, storing the final result in RESULT. Decimals greater than or equal to 0.5 promote unity value immediately above. The block ends with success and Done output is activated.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   VALUE : REAL := 52.5;

   RESULT : REAL;

END_VAR

 

RESULT := FB_ROUND(EN:=DI1, Value:=VALUE, Done=>DO1);