CD522TwoWordCounters (FB)

FUNCTION_BLOCK CD522TwoWordCounters EXTENDS AbbLConCA

Function block to access all IO-Values for the 16-Bit-Counter of CD522. This FB is valid to be used with mode 3 and 4

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. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConCA

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConCA

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.

AbbLConCA

Input

CntNum

WORD

0

0 or 1, declares if counter 0 or counter 1 is to be used

EnCnt

BOOL

FALSE

Enable (TRUE) or disable (FALSE) the counter function of the module

EnTouch

BOOL

FALSE

Enable (TRUE) or disable (FALSE) the touch function of the module. Touch inputs are I3 (Counter0) and I11 (Counter1). In “CD522 Parameters” you have to configure these inputs as Value = “TOUCH”

EdgeTouch

BOOL

FALSE

Select (TRUE) positive or (FALSE) negative edge for touch

Ud1

BOOL

FALSE

Up (FALSE) or down (TRUE) counting mode

Ud2

BOOL

FALSE

Up (FALSE) or down (TRUE) counting mode

Reset1

BOOL

FALSE

Reset current counter value1

Reset2

BOOL

FALSE

Reset current counter value2

AdrIn

POINTER TO WORD

0

Address of process image input. See ../Structs/CD522In for more information about structure

AdrOut

POINTER TO WORD

0

Address of process image output. See ../Structs/CD522Out for more information about structure

Output

ErrorID

ERROR_ID

ERROR_ID.NO_ERROR

Error code description

Act1

INT

0

16 bit current counter value (Input A)

Act2

INT

0

16 bit current counter value (Input B)

CntTouch1

INT

0

16 bit touch value counter

CntTouch2

INT

0

16 bit touch value counter

Ofl1

BOOL

FALSE

Overflow on counter (Input A)

Ofl2

BOOL

FALSE

Overflow on counter (Input B)

RdyTouch

BOOL

FALSE

Set to TRUE when new touch value is available. To delete RdyTouch set EnTouch to FALSE. To allow a new Touch, set EnTouch to TRUE again

ResetIn1

BOOL

FALSE

Reset 1 signal detected

ResetIn2

BOOL

FALSE

Reset 2 signal detected