Navigation:  Equipments (Devices) > SCA06 > Ladder > Logic > Logic Bit >

RESETBIT

Previous pageReturn to chapter overviewNext page

Logical block used to perform reset of a specific bit in a field.

 

Ladder Representation

 

RESETBIT_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_IN_OUT

Data

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT

Variable whose bit will be changed

VAR_INPUT

EN

BOOL

Block enabling


Position

BYTE USINT

Position of the bit that will be changed

VAR_OUTPUT

DONE

BOOL

Operation successful

 

Operation

 

This block when it has a TRUE value in EN, resets the bit indicated in Position in the Data variable that is forwarded to the output already with its updated value.

 

When EN has FALSE value, Data remains unchanged.

 

The DONE variable receives the same EN value, except when there is an error in the reset of the bit, then getting a FALSE value.

 

wpshelp_common_fig_note

NOTE!

It is important to notice that Position is within the range of values of bits corresponding to variable type in Data. For example: if Data is a BYTE, it has 8 bits, and Position must contain a value between 0 and 7.

 

Block Flowchart

 

RESETBIT_flowchart

 

Example in Ladder

 

RESETBIT_example01

 

The example above resets the bit of AUX zero position, whose initial value is 200 (1100 1000, in binary). Since this bit already had FALSE value, nothing has changed.

 

RESETBIT_example02

 

The example above resets the bit in position three of AUX by changing its binary value and, therefore, its decimal representation.

 

RESETBIT_example03

 

The example above resets the bit in position nine of AUX. Since AUX is a variable BYTE type, it has only eight bits. Thus, the example above creates a runtime error in the block and therefore the output is not enabled.

 

Example in ST

 

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

 

 

VAR

   AUX : BYTE := 2#1101_0000;

   POS : BYTE := 3;

END_VAR

 

DO1 := FB_RESETBIT(

   EN:=DI1,

   Data:=AUX,

   Position:=POS);