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
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, declares if counter 0 or counter 1 is to be used
EnCntBOOLFALSE
Enable (TRUE) or disable (FALSE) the counter function of the module
EnTouchBOOLFALSE
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”
EdgeTouchBOOLFALSE
Select (TRUE) positive or (FALSE) negative edge for touch
Ud1BOOLFALSE
Up (FALSE) or down (TRUE) counting mode
Ud2BOOLFALSE
Up (FALSE) or down (TRUE) counting mode
Reset1BOOLFALSE
Reset current counter value1
Reset2BOOLFALSE
Reset current counter value2
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
Act1INT0
16 bit current counter value (Input A)
Act2INT0
16 bit current counter value (Input B)
CntTouch1INT0
16 bit touch value counter
CntTouch2INT0
16 bit touch value counter
Ofl1BOOLFALSE
Overflow on counter (Input A)
Ofl2BOOLFALSE
Overflow on counter (Input B)
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
ResetIn1BOOLFALSE
Reset 1 signal detected
ResetIn2BOOLFALSE
Reset 2 signal detected