IoCnt (FB)

FUNCTION_BLOCK IoCnt EXTENDS AbbLConCA

Handle fast counters on S500 IO-modules

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

BusType

BYTE

0

BUS : 0 = default , 1 = CAN

Mode

BYTE

0

FC Mode

AdrInputs

POINTER TO BYTE

0

Pointer to Inputs

AdrOutputs

POINTER TO BYTE

0

Pointer to Outputs

EnVisu

BOOL

FALSE

Enable settings in visu

Inout

En1

BOOL

Enable counting counter 1

UD1

BOOL

Up / down counter 1

EnOut1

BOOL

Enable output counter 1 in user program

Set1

BOOL

Set start value counter 1

Start1

DWORD

Start value counter 1

End1

DWORD

End value counter 1

En2

BOOL

Enable counting counter 2

UD2

BOOL

Up / down counter 2

EnOut2

BOOL

Enable output counter 2 in user program

Set2

BOOL

Set start value counter 2

Start2

DWORD

Start value counter 2

End2

DWORD

End value counter 2

Output

ErrorID

ERROR_ID

ERROR_ID.NO_ERROR

Error code describing error condition

CntState

WORD

0

Counter mode

CF1

BOOL

FALSE

Carry Flag 1 := TRUE -> end value reached

Act1

DWORD

0

Actual value counter 1

CF2

BOOL

FALSE

Carry Flag 2 := TRUE -> end value reached

Act2

DWORD

0

Actual value counter 2