Hitachi NJI-350B Video Game Controller User Manual


 
Chapter 8 High-speed counter, PWM / Pulse train output and Analogue I/O
8-8
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:
1514131211109876543210
WRF07E:
abcdefgh Not used
Initial value:
0000000000000000
Figure 8.8 Special internal output for setting counter input
Bit
Setting
value
Count edge Bit
Setting
value
Count operation
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:
On-preset value for counter 1
WRF073:
On-preset value for counter 2
WRF074:
On-preset value for counter 3
WRF075:
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:
Off-preset value for counter 1
WRF077:
Off-preset value for counter 2
WRF078:
Off-preset value for counter 3
WRF079:
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.