Navigation:  Equipments (Devices) > PLC200 > Program > Hardware >

READENC3

Leitor de Encoder com Diferencial

Previous pageReturn to chapter overviewNext page

Block that reads the value of pulses from an encoder according to a chosen type of reading, calculating differentials between calls to the block.

 

Ladder Representation

 

READENC3_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Source#

BYTE

Counting source

VAR_OUTPUT

ENO

BOOL

Output enabling

Value

DINT DWORD UDINT

Counting value

Delta

DINT DWORD UDINT

Difference between the previous counting and current counting

 

Operation

 

When this block has a TRUE value in EN, it gets the number of pulses counted in the encoder since energizing of the PLC300, as selected in Source#, and transfers them to Value. The value of Delta is the difference between the pulses counted in this run and the previous run.

 

When EN has FALSE value, Value and Delta remain unchanged.

 

The ENO value forwards to the next Ladder block the EN value after the operation is completed.

 

Block Flowchart

 

READENC3_flowchart

 

Example in Ladder

 

READENC3_example01

 

The example above when identifying a leading edge on DI1, gets the number of pulses on input A since the energizing of the equipment, storing the value in VALUE. The difference between the current value and the value previously read is stored in DIFFERENCE. The block ends with success, ENO output is activated.

 

Example in ST

 

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

 

 

VAR

  VALUE : UDINT;

   DIFFERENCE : UDINT;

END_VAR

 

DO1 := FB_READENC3(

   EN:=DI1,

   Source:=1,

  Value=>VALUE,

  Delta=>DIFFERENCE);