English
Language : 

UPD784938 Datasheet, PDF (522/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 22 EDGE DETECTION FUNCTION
22.3 P21 Pin Edge Detection
In P21 edge detection, digital noise elimination is performed using the clock (fSMP) specified by the sampling clock
selection register (SCS0). In digital noise elimination, input is sampled using the fSMP clock, and if the input level is not
the same at least three times in succession (if it is the same only two or fewer times in succession), it is eliminated as noise.
Therefore, the level must be maintained for at least 3 fSMP clock cycles in order to be recognized as a valid edge.
Remark When the pulse width of a signal with a comparatively long pulse width and a lot of noise, such as a reception
signal infrared remote controller, is measured, or when a signal is input in which oscillation occurs when an
edge occurs, as with switch input chattering, for instance, it is better to set the sampling clock to low speed
with the sampling clock selection register (SCS0). If the sampling clock is high-speed, there will be a reaction
to the short-pulse noise components as well, and the program will frequently have to judge whether the input
is noise or a signal. However, by slowing down the sampling clock, reaction to short pulse width noise is
eliminated and thus the program does not have to make judgments so frequently, and can thus be simplified.
Figure 22-5. P21 Pin Edge Detection
P21 input
fSMP
P21 input signal after
noise elimination
Rising edge
Falling edge
Digital noise
elimination by fSMP clock
Cautions 1. Since digital noise elimination is performed with the fSMP clock, there is a delay of 2 to 3 fSMP clocks
between input of an edge to the pin and the point at which the edge is actually detected.
2. If the input pulse width is 2 to 3 fSMP clocks, it is uncertain whether a valid edge will be detected.
Therefore, to ensure reliable operation, the level should be held for at least 3 clocks.
3. If noise input to the pin is synchronized with the fSMP clock in the µPD784938, it may not be
recognized as noise. If there is a possibility of such noise being input, noise should be eliminated
by adding a filter to the input pin.
522
Preliminary User’s Manual U13987EJ1V0UM00