English
Language : 

PD17012_15 Datasheet, PDF (209/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
17.4.2 Program example of IF counter function
A program example of the IF counter function is shown below.
As shown in this example, a wait time must elapse after an instruction that selects the P1B3/FMIFC or P1B2/
AMIFC pin as the IF counter pin has been executed before counting is started.
This is because the internal AC amplifier may not operate normally immediately after each pin has been
selected, as explained in 17.4.1.
Example To count frequency on P1B3/FMIFC pin (gate time: 8 ms)
INITFLG
IFCMD1, NOT IFCMD0, IFCCK1, NOT IFCCK0
; Selects FMIFC pin and sets gate time to 8 ms.
Wait
; Internal AC amplifier stabilization time
LOOP:
SKT1
BR
IFCG
READ
Processing A
; Detects opening/closing of gate.
; Branches to READ: when gate is closed.
; Do not read data of IF counter by this processing A.
BR
READ:
GET
LOOP
DBF, IFC
; Reads value of IF counter data register to data buffer.
17.4.3 Error of IF counter
The IF counter may have a gate time error and a count error.
These errors are explained in (1) and (2) below.
(1) Error of gate time
The gate time of the IF counter is created by dividing the 4.5 MHz system clock.
Therefore, if the system clock deviates “+x” ppm, the gate time deviates “−x” ppm.
(2) Count error
The IF counter counts the frequency at the rising edge of an input signal.
If a high level is input to the pin when the gate is opened, therefore, one excess pulse is counted.
However, counting is not performed because of the status of the pin when the gate is closed.
Therefore, a count error of “+1, −0” may occur.
Data Sheet U10101EJ4V0DS
207