Example 1 - direct addressing, Example 1 - direct addressing -2 – Rockwell Automation 1746-HSCE2 Multi-Channel High Speed Counter Module User Manual

Page 94

Advertising
background image

Publication 1746-UM002B-EN-P - August 2004

6-2 Application Examples

Example 1 - Direct
Addressing

This example sets up the module to count the number of pulses from
a high-speed device and apply that information to your ladder
program. The module is in Class 1, mode 3, with 4 counters available.

Ladder File 8 - HSCE2

0000

S:1

15

U

B3:0

0

U

B3:0

1

MOV

Move
Source

0

0 <
Dest

N11:0

140<

MOV

Fill File
Source

0

Dest

Length

8

#O:1.0

FLL

MUL

Multiply
Source A

10

10 <
Source B

N11:2

14 <
Dest

N11:1

140<

MUL

0001

S:1

15

B3:0

0

B3:0

1

JSR

Jump To Subroutine
SBR File Number

U:9

JSR

0002

RET

Return

RET

0003

END

FIRST_PASS

FIRST_PASS

HSCE2_INIT_DONE

HSCE2_INIT_DONE

HSCE2_ERROR

HSCE2_ERROR

DATA_BLOCK_OFFSET

MAX_BLOCK_ADDR

Prior to use, the programmer sets N11:2 to the total number of data blocks which will be entered into file N10 (not including the Counter Control
Block), adds one rung for each configuration block (including the Counter Control Block), and initializes the data blocks in file N10. Ten integer data
blocks are used (instead of eight) to simplify the display in data windows. Note: The Counter Control Block rung differs from the other rungs
because the Counter Control Block does not require hand-shaking.
The first pass of the program initializes the following values:
1. The HSCE2 initialization done bit (B3/0) is unlatched.
2. The HSCE2 error bit (B3/1) is cleared.
3. The Counter Configuration Data Block is cleared. Note: The init HSCE2 routine (ladder file 9) is bypassed during the first pass to ensure the
Configuration Data Block is reset prior to transfer of the first configuration block
4. The transfer data block offset (N11:0) is cleared; i.e. the first
data block starts at offset 0 in N10 file.
5. Max data block address (N11:0) is calculated as: Total Data Blocks (N11:2) x 10 words/data block.

If the HSCE2 initialization is not done, and the HSCE2 has not errored, call the HSCE2
initialization routine.

Advertising