
μ
PD17016, 17017
256
20.7 Notes on Using Frequency Counter
The frequency counter shares its hardware with the BEEP function explained earlier.
Therefore, the BEEP function and frequency counter cannot be used at the same time.
If the data of the IF counter mode select register and IF counter data register are manipulated while the BEEP
function is used, the operation explained in 20.7.1 is performed.
If the BEEP output software macro is executed when the frequency counter is used, the operation explained
in 20.7.2 is performed.
The assembler embedded macroinstruction SETn cannot be used to manipulate the IFCRES and IFCSTRT
flags, as explained in 20.4.6. This is explained in more detail in 20.7.3.
20.7.1 When BEEP output is used
(1) When IFCMD1 and IFCMD0 flags of IF counter mode select register are manipulated
If a value other than “0” is written to the IFCMD1 and IFCMD0 flags, the P1B
0
/BEEP pin retain the current
output level, and stops the BEEP output.
When both the IFCMD1 and IFCMD0 flags are reset to “0” again, the BEEP output is started.
(2) When IF counter data register is manipulated
The BEEP output is not affected even if a read (GET) or write (PUT) instruction is executed.
When the IF counter data register is read, an “undefined” value is read. Nothing is changed even if data is
written to the register.
Note, however, that the IF counter data register is a read-only peripheral register. Do not write data to this
register. If the write instruction “PUT IFC, DBF” is executed, the 17 series assembler outputs an error.
20.7.2 When frequency counter is used
If the BEEP output software macro is executed while the frequency counter is used, the frequency counter
is forcibly stopped, and the BEEP output is started. At this time, the contents of the window register (WR) and
data buffer (DBF) are destroyed. To operate the frequency counter again, once stop the BEEP output by using
the BEEPOFF macro, and start counting from the beginning.