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
EnableBOOLFALSE
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
BusyBOOLFALSE
Operation is running (while output Error is FALSE)
AbbLConCA
ErrorBOOLFALSE
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
CntNumWORD0
0 or 1, counter 0 or counter 1 is used
EnCntBOOLFALSE
Enable( TRUE) or disable (FALSE) the counter function of the module
UdBOOLFALSE
Up (FALSE) or down (TRUE) counting mode
ResetBOOLFALSE
Reset current counter value. In “CD522 Parameters” you also can configure one of the counter inputs (e.g. I4) = “RESET”
EnTouchBOOLFALSE
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”
EdgeTouchBOOLFALSE
Select (TRUE) positive or (FALSE) negative edge for touch
SetBOOLFALSE
Set current counter value to value “CntSet”. In “CD522 Parameters” you also can configure one of the counter inputs (e.g. I5) = “SET”
CntSetINT0
Value used for set function
AdrInPOINTER TO WORD
0
Address of process image input. See ../Structs/CD522In for more information about structure
AdrOutPOINTER TO WORD
0
Address of process image output. See ../Structs/CD522Out for more information about structure
Output
ErrorIDERROR_ID.NO_ERROR
Error code description
CfBOOLFALSE
Carry flag. State of counter (TRUE = positive / FALSE = negative) after zero-crossing
SetInBOOLFALSE
Set signal detected
ResetInBOOLFALSE
Reset signal detected
RdyTouchBOOLFALSE
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
ActINT0
16 bit current counter value (Input A). Input B enables counting, when it is TRUE
CntTouchINT0
16 bit touch/catch value