Chapter 8 High-speed counter, PWM / Pulse train output and Analogue I/O

8.2 High-Speed Counter (Single-Phase)

The high-speed counter settings are stored in the special internal outputs (WRF070 to 7E). It is only possible to perform the setting through the special internal output (WRF071) when the CPU is stopped and the output is turned off. Once all the input/output settings are completed, the settings of each counter can be changed using the special internal outputs for individual setting (WRF058 to 5B), regardless of whether the CPU is operating or stopped. In addition, the settings can be changed by a program using the FUN instruction (FUN140 to 142, and 146). Refer to the chapter about the FUN instruction for information about how to use the FUN instruction for setting.

8.2.1 Operation of Single-Phase Counter

(1)Basic operation

Figure 8.5 describes the basic operation of the high-speed counter.

FFFFH

Off preset

2]

3]

4]

On preset

0000H

U:Up counter

D:Down counter

Coincidence ON

output OFF

1]

7]

 

5]

 

 

 

 

 

 

 

 

 

 

6]

 

 

U

U

D

U

U

D

 

D

 

 

D

 

 

 

 

 

 

R7FC to R7FF

ON

Coincidence

OFF

interrupt

ON

n:Even number OFF

m:Odd number

1]

On preset

2]

Off preset

INT2n INT2m

INT2n

INT2n INT2m

INT2n INT2n INT2m

 

INT2n

INT2n

INT2m

 

 

4]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Off preset

 

 

 

 

 

 

Each coincidence interrupt

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Coincidence interrupt

 

 

 

 

 

Coincidence interrupt

and INT number

 

 

occurrence

 

 

 

 

 

 

occurrence

 

Counter 1

 

At on-preset

 

INT20

Coincidence output On

 

 

 

 

 

Coincidence output On

 

 

 

At off-preset

 

INT21

 

 

 

 

 

 

Counter 2

 

At on-preset

 

INT22

 

 

5]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

At off-preset

 

INT23

 

 

 

 

 

 

 

 

 

 

 

 

On preset

 

 

 

 

 

 

 

Counter 3

 

At on-preset

 

INT24

 

 

 

 

 

 

 

 

 

 

 

At off-preset

 

INT25

Coincidence interrupt

 

 

 

 

 

 

Coincidence interrupt

 

Counter 4

 

At on-preset

 

INT26

 

 

 

 

 

 

 

 

 

At off-preset

 

INT27

occurrence

 

 

 

 

 

 

occurrence

 

 

 

 

 

 

 

 

 

 

 

 

Coincidence output Off

 

 

 

 

 

 

Coincidence output Off

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 8.5 Basic operation of high-speed counter (single-phase)

Up counter

1] The counter output turns on* when the current counter value becomes larger than the on-preset value. The interrupt process (INT2n) starts up if an interrupt program is used in the running user program.

2] The counter output turns off when the current counter value becomes larger than the off-preset value. The interrupt process (INT2m) starts up if an interrupt program is used in the running user program.

3] The counter values wrap around in a ring. That is, the current counter value goes back to 0h when one more pulse is counted after the maximum value (FFFFH) is reached.

Down counter

4] The counter output turns on* when the current counter value becomes smaller than the off-preset value. The interrupt process (INT2m) starts up if an interrupt program is used in the running user program.

5] The counter output turns off when the current counter value becomes smaller than the on-preset value. The interrupt process (INT2n) starts up if an interrupt program is used in the running user program.

6] The counter values wrap around in a ring. That is, the current counter value becomes FFFFH when one more pulse is counted after the minimum value (0H) is reached. Note also that the initial value of the counter is 0H, and the value reaches FFFFH after the first pulse is counted after the start of operation.

8-6

Page 215
Image 215
Hitachi NJI-350B manual High-Speed Counter Single-Phase, Operation of Single-Phase Counter, Basic operation