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

8.2.2 Setting of Single-Phase Counter

If either one of operation modes 1, 2, or 3 is selected, the single-phase counter should be set using the special internal output (WRF072 to WRF07E). In order to make the contents of the various settings valid, it is necessary to turn on the special internal output R7F5. The settings can be changed using the FUN instruction during the CPU operation (some settings cannot be changed, however.)

(1)Setting the counter input

Bit:

WRF07E:

Initial value:

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

a

b

c

d

e

f

g

h

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Figure 8.8 Special internal output for setting counter input

 

Bit

Setting

Count edge

Bit

Setting

Count operation

 

value

value

 

 

 

 

 

Counter 1

a

0

Rising edge

e

0

Up count operation *1

 

 

1

Falling edge

 

1

Down count operation *1

Counter 2

b

0

Rising edge

f

0

Up count operation *1

 

 

1

Falling edge

 

1

Down count operation *1

Counter 3

c

0

Rising edge

g

0

Up count operation *1

 

 

1

Falling edge

 

1

Down count operation *1

Counter 4

d

0

Rising edge

h

0

Up count operation *1

 

 

1

Falling edge

 

1

Down count operation *1

*1 Can also be made valid by executing FUN142.

In case of mode 1, the settings for counter 3 and 4 are ignored. In case of mode 3, the settings for counter 1 to 3 are ignored.

(2)Setting the on-preset value

Set the count value at which the counter output is turned on (the on-preset value) for every counter used. Any value in the range from 0 to FFFFH (0 to 65, 535) can be set. If the on-preset value is set to the same value as the off-preset value, the counter will not perform any counting operation (see (5)).

WRF072:

WRF073:

WRF074:

WRF075:

On-preset value for counter 1

On-preset value for counter 2

On-preset value for counter 3

On-preset value for counter 4

Figure 8.9 Special internal outputs for setting the on-preset values

In case of mode 1, WRF074 and WRF075 are used to set the frequency for the PWM/pulse outputs. In case of mode 3, WRF073 and WRF074 are used to set the frequency for the PWM/pulse outputs.

(3)Setting the off-preset value

Set the count value at which the counter output is turned off (the off-preset value) for every counter used. Any value in the range from 0 to FFFFH (0 to 65, 535) can be set. If the off-preset value is set to the same value as the on-preset value, or larger than the on-preset value, the counter will not perform any counting (see (5).).

WRF076:

WRF077:

WRF078:

WRF079:

Off-preset value for counter 1

Off-preset value for counter 2

Off-preset value for counter 3

Off-preset value for counter 4

Figure 8.10 Special internal outputs for setting off-preset values

In case of mode 1, WRF078 and WRF079 are used to set the on-duty for the PWM/pulse outputs. In case of mode 4, WRF077 and WRF078 are used to set the on-duty for the PWM/pulse outputs.

8-8

Page 217
Image 217
Hitachi NJI-350B manual Setting of Single-Phase Counter