0% found this document useful (0 votes)
49 views5 pages

Fast Counter Function Documentation

Uploaded by

alexis.palacios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views5 pages

Fast Counter Function Documentation

Uploaded by

alexis.palacios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3.1.2.

Using the module Page 1 of 5

3.1.2. Using the module

The module can be accessed by the control programs (STL or LDR) as a function or program module.
The desired function is transferred in the first input parameter (FU32).

Overview of modules

FECCNTR - Resetting the fast counter


FECCNTR - Parametrizing the fast counter
FECCNTR - Activating the fast counter
FECCNTR - Interrogating the status and current counter value

The fast counters can be parametrized so that when a preselect value is reached:

- an output word (OW) can be modified

- a specified program can be started

- an output word (OW) can be modified and a program started.

Each counter can be set for automatic or manual restart irrespective of the others.

FECCNTR
FECCNTR — Resetting the fast counter

The fast counter is deactivated.

Input parameter
FU32 0 = function: Reset
FU33 0 = counter 0

1 = counter 1

Return parameter
FU32 None

Nothing will happen if an inactive counter is reset.

Example

IF ... " Condition


THEN SET CMPx " Access the fast
" counter module
WITH V0 " Function: Reset
WITH Vy " Definition of fast counter:
" y=0: first counter
" y=1: second counter

[Link] 11/1/2024
3.1.2. Using the module Page 2 of 5

FECCNTR
FECCNTR — Parametrizing the fast counter

Definition of the counter preselect and the activities when the counter preselect value is reached. The
function must be accessed in the inactive status of the fast counter (before activation or after the reset
function).

Input parameter
FU32 1 = function: parameter setting
FU33 0 = first counter; 1 = second counter
FU34 Value for counter preselect, (presetting = 0) (16-bit decimal or HEX, range 0...65535,
$0...$FFFF)
FU35 Specify activities when counter preselect value is reached.

0 = No activities (presetting)

1 = Influence output word

2 = Start program

3 = Start program and influence output word


FU36 Higher-value byte: Program number

Lower-value byte: Output word number

All values must be specified in HEX format.

Example: Program 12, output word 0: $0C00


FU37 Higher-value byte: Output mask In order to modify a bit in the output word, the same bit must be
set in the mask.

Lower-value byte: Value for the outputs. Set (1) or Reset (0) the output if the bit is set in the
output mask.

All values must be specified in HEX format. Example:

Set output x.7, outputs x.0...x.6 unmodified: $8080

Set output x.7, reset outputs x.0...x.6: $FF80


FU38 0 = no automatic restart of counter

1 = automatic restart of counter

Return parameter
FU32 None

[Link] 11/1/2024
3.1.2. Using the module Page 3 of 5

Each pulse at the input increments the counter status and, if the preselect value is reached, the activity
defined in parameter 4 will be carried out:

1. No activity

2. An output word is modified.

3. An STL or LDR program is started.

4. An output word is modified AND a program is started.

Parameter 5 defines in the higher-value byte the number of the program to be started, in the lower-value
byte the number of the output word to be modified. The value must be specified in hexadecimal format.
If parameter 4 < > is 3, the non-used byte will simply be ignored.

Examples:

V$0600 defines output word (OW) 0 and program 6. V$0901 defines output word (OW) 1 and program
9.

Parameter 6 is only of importance if parameter 5 has the value 1 or 3, i.e. when the preselect value is
reached, an output word is modified.

The higher-value byte contains the output mask, the set bits of which specify the bits to be modified in
the output word. If the same bit is also set in the lower-value byte, the corresponding output bit will be
set, otherwise it will be reset. Due to this separation of the mask and the value, certain bits can be
protected from modification. The value must be specified in hexadecimal format.

Examples:

V$8080 Set output x.7, outputs x.0...x.6 remain unmodified V$FF01 Set output x.0, reset outputs
x.1...x.7

In parameter 7 the user can determine whether or not there is to be an automatic restart of the counter
when the preselelct value is reached.

FECCNTR
FECCNTR — Activating the fast counter

When the module is thus accessed, the set parameters will be transferred and the fast counter will be
activated.

Input parameter
FU32 2 = function: activate counter
FU33 0 = first counter

1 = second counter

[Link] 11/1/2024
3.1.2. Using the module Page 4 of 5

Return parameter
FU32 None

The counter must be parametrized before this function is triggered.

If a counter is started without automatic restart and reaches the preselect value, it must be reset before it
can be started again.

FECCNTR
FECCNTR — Interrogating the status and current counter value

When the module is thus accessed, the status and the current counter value of a fast counter will be
interrogated.

Input parameter
FU32 3 = function: status interrogation
FU33 0 = counter 0

1 = counter 1

Return parameter
FU32 Status

0 = counter active

1 = counter inactive
FU33 Current counter value
FU34 With FEC always 0 (in order to be compatible with 32-bit counters)

[ Note
N
The status in FU32 supplies a sensible value only if the automatic restart is not permitted.

Example

IF ... " Condition


THEN CMPx " Access the fast
" counter module
WITH V3 " Function: Status interrogation
WITH Vy " Definition of fast counter

"Check result ...


IF (FU32 =V0) " Counter is still active
THEN ... " Other activities

[Link] 11/1/2024
3.1.2. Using the module Page 5 of 5

LOAD FU33 " Save current counter value


TO R21 " in register 21

[Link] 11/1/2024

You might also like