OBIOTouchProbe (FB)

FUNCTION_BLOCK OBIOTouchProbe EXTENDS AbbLConC3

A binary input can be used to save a counter value at rising edge or falling edge.

It is possible to use the OBIOTouchTrigger with respect to CounterValue from: OBIOEncoderCounter (FB), OBIOForwardCounter (FB) or OBIOPulseTrainOutput or :ref:`OBIOPulseTrainSingleOutput
precondition

the respective channel is configured as touch trigger, and also a counter channel has to be configured.

Up to 4 touch trigger are possible.

The respective counter is linked to the block by “Counter” input. The counter can be of type OBIOEncoderCounter, OBIOForwardCounter or OBIOPulseTrainOutput or OBIOPulseTrainSingleOutput
The counter value is saved independently from PLC cycle with a delay of <10 microseconds.

Note

This block should just be called once per cycle otherwise inconsistent values could be send to PRU, if send twice in short time.

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Enable

BOOL

FALSE

A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. Execution will continue forever until a falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConC3

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConC3

Error

BOOL

FALSE

Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.

AbbLConC3

Input

Channel

BYTE

0..3

Invert

BOOL

by default, use rising edge. With Invert=TRUE, falling edge is used

BothEdges

BOOL

use rising and falling edge to create a TouchProbe value, will overwrite input Invert.

EnableTouch

BOOL

Enables the touch trigger mode. A rising edge at touch-input will then capture the actual value as CounterTouchValue

ContinuousMode

BOOL

with ContinuousMode=TRUE and EnableTouch=TRUE, the touch trigger will reenable itself automatically.

In this mode, the output ReadyTouch will be true for just 1 cycle.

With ContinuousMode=FALSE, a rising edge at EnableTouch is required to retrigger the next TouchProbe, this will set output ReadyTouch=TRUE until EnableTouch=FALSE.

Also with ContinuousMode=TRUE, it is required to call the block every PLC cycle.

Inout

Counter

OBIOBaseCounter

link the block to the counter which will be used to trigger the output

Output

ErrorID

Error_ID

Error_ID.NO_Error

Error code

ReadyTouch

BOOL

FALSE

Indicates CounterTouchValue is ready (=EnableTouch). Will be TRUE as long as EnableTouch is TRUE, or 1 cycle with ContinuousMode=TRUE

TouchState

BOOL

will show the state from binary input which was valid when the CounterTouchValue was captured. It can just be used with ReadyTouch=TRUE. The state can be changed with a rising edge at ReadyTouch.

InputState

BOOL

will show the actual value from the binary input, independend from TouchProbe result.

CounterTouchValue

UDINT

0

captured counter value, valid with ReadyTouch