CD522OneWordCounter (FB)

FUNCTION_BLOCK CD522OneWordCounter 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 8

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, counter 0 or counter 1 is used

EnCnt

BOOL

FALSE

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

Ud

BOOL

FALSE

Up (FALSE) or down (TRUE) counting mode

Reset

BOOL

FALSE

Reset current counter value. In “CD522 Parameters” you also can configure one of the counter inputs (e.g. I4) = “RESET”

EnTouch

BOOL

FALSE

Enable (TRUE) or disable (FALSE) the touch/catch 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

Set

BOOL

FALSE

Set current counter value to value “CntSet”. In “CD522 Parameters” you also can configure one of the counter inputs (e.g. I5) = “SET”

CntSet

INT

0

Value used for set function

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

Cf

BOOL

FALSE

Carry flag. State of counter (TRUE = positive / FALSE = negative) after zero-crossing

SetIn

BOOL

FALSE

Set signal detected

ResetIn

BOOL

FALSE

Reset signal detected

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

Act

INT

0

16 bit current counter value (Input A). Input B enables counting, when it is TRUE

CntTouch

INT

0

16 bit touch/catch value