You are on page 1of 11

S7 200

HIGH SPEED COUNTERS

HSC

High speed counters counts the high speed events independent of the CPU. The frequency of the counting is dependent of the CPU. Each counter has dedicated inputs for

Clocks Direction control Reset Start

HSC0 to HSC5

CPU SUPPORT

Following counting frequency are supported by the S7-200 CPUs


224XP 224 XPsi 14DI/10DO 6 4 at 30 kHz 2 at 200 kHz Two Phase 2 at 20 kHz 4 at 20 kHz 3 at 20 kHz 1 at 100 kHz 4 at 20 kHz

CPU

221

222

224

226

IO
HSCs Single Phase

6DI/4DO 8DI/6DO 14DI/10DO


4 4 6 6 at 30 kHz 4 at 30 kHz

24DI /6 DO
6 6 at 30 kHz

INPUTS

Predefined inputs for individual HSC.


HSC 3 I 0.0 I 0.1 I 0.2 HSC 0 I 0.6 I 0.7 I 1.0 HSC 1 I 1.3 I 1.4 HSC 2 HSC 5 I 0.3 I 0.4 I 0.5 HSC 4 I 1.1

I 1.2

I 1.5

MODES

You can program the High Speed Counters using 12 different Modes. Mode 0,1,2

Single Phase Counter With Internal Direction Control Mode 0 :- Clock Mode 1 :- Clock, Reset Mode 2 :- Clock, Reset, Start Single Phase Counter With External Direction Control Mode 3 :- Clock, Direction Mode 4 :- Clock, Direction, Reset Mode 5 :- Clock, Direction, Reset, Start

Mode 3,4,5

MODES

Mode 6,7,8

Two Phase Counters with 2 Clock Inputs Mode 6 :- Clock Up, Clock Down Mode 7 :- Clock Up, Clock Down, Reset Mode 8 :- Clock Up, Clock Down, Reset, Start

Mode 9,10,11

A/B Phase Quadrature Counter Mode 3 :- Clock A, Clock B Mode 4 :- Clock A, Clock B, Reset Mode 5 :- Clock A, Clock B, Reset, Start
Only HSC0 and HSC3 support mode12. HSC0 counts the number of pulses going out of Q0.0. HSC3 counts the number of pulses going out of Q0.1.

Mode 12 :

ADDRESS

Special Memory (SMBs) used to define the preset value, current Value, mode of the High Speed Counters. You can also read the status of the counters using status Byte

HSC 0 Status Byte Control Byte Preset Value PV SMB 36 SMB 37

HSC 1 SMB 46 SMB 47

HSC 2

HSC 3

HSC 4

HSC 5

SMB 56 SMB 136 SMB 146 SMB 156 SMB 57 SMB 137 SMB 147 SMB 157

Current Value CV SMD 38 SMD 48 SMD 58 SMD 138 SMD 148 SMD 158 SMD 42 SMD 52 SMD 62 SMD 142 SMD 152 SMD 162

STATUS BYTE INFO


7 6 5 4 to 0

Not Used Current counting direction status bit 0 = down; 1 = up Current Value Equals Preset value 0 = not equal; 1 = equal Current value greater than preset value status bit: 0 = less than or Equal; 1 = greater then

CONTROL BITS

Initial 3 bits are used for HSC0, HSC1, HSC2, HSC4 Only
2 1 0
Active level control bit for Reset 0 = active high 1 = active low

Active level control bit for Start 0 = active high 1 = active low **Only for HSC1 and HSC2

Counting rate selection for Quadrature counters 0 = 4x counting rate 1 = 1x counting rate

CONTROL BITS
7 6 5 4 3

Counting Direction: 0 = down 1 = up Write the counting direction 0 = no update 1 = update Write the preset value 0 = no update; 1 = update Write current value 0 = no update 1 = update Enable HSC 0 = disable 1 = enable

PROGRAM

To program the HSC , Use the following steps

Set the control byte Set the Current Value Set the Preset Value Define the Counter and Mode Instruction:- HDEF Assign and Enable the Interrupt Routine Activate the High Speed Counter Instruction:- HSC

You might also like