Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
AN018202-0708
Input frequency
……
Output of Timer
……
100msec
1 sec
AN018202-0708 Page 2 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
A Reload value High and Low byte, which equal For more information on Z8 Encore! Development
38h and 40h respectively, are used with a prescale Kit, refer to Z8 Encore!® Flash Microcontroller
value of 128 in an 18.432 MHz system clock. Development Kit User Manual (UM0146).
To obtain a 1 sec time-out, a counter is used to The compiled code, available in the AN0182-
count the timer interrupts. SC01.zip file (on www.zilog.com), is down-
loaded to the Z8 Encore! MCU Flash memory
The number of rising edges of the input signal using ZDS II IDE—Z8 Encore! v4.6.11.
(Port A bit 2) within 1 sec is counted, which is the
frequency of the input signal in Hertz. This fre- Equipment Used
quency is displayed on the 5x7 LED Display.
The equipment used are as follows:
AN018202-0708 Page 3 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
Note: Other waveforms can also be used as Note: Frequencies above 10 kHz were not
inputs. measured because the LED display
used for the measurement does not
4. Read the displayed value on the 5x7 LED show more than four digits.
Matrix Display on the Z8 Encore! Develop-
ment Board.
AN018202-0708 Page 4 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
Summary References
This application note demonstrates the capability The documents associated with Z8 Encore! avail-
of the Z8 Encore!® MCU to accurately measure the able on www.zilog.com are provided below:
frequency of input signals up to 10 kHz.
• Z8 Encore!® Flash Microcontroller Develop-
The Z8 Encore! Frequency Counter is simple, and ment Kit User Manual (UM0146)
easy to use, with no additional hardware require-
ments or any calibration procedures. A Z8 Encore! • Z8 Encore! XP® F64XX Series Development Kit
MCU with the code and the signal to be measured User Manual (UM0151)
is all that is necessary; the signal frequency may be • Z8 Encore!® F0822 Series Development Kit
displayed or may be used for further computation if User Manual (UM0150)
required.
• Z8 Encore! XP® F64XX Series Product Specifi-
cation (PS0199)
• eZ8 CPU User Manual (UM0128)
• Zilog Developer Studio II—Z8 Encore! User
Manual (UM0130)
AN018202-0708 Page 5 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
Appendix A—Flowcharts
This appendix contains the flowcharts associated with the Z8 Encore! Frequency Counter application
described in this application note.
START
Update display;
AN018202-0708 Page 6 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
START
IRET
AN018202-0708 Page 7 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
START
No
Timer0 timed out?
Yes
No
Delay Counter = 10?
Yes
IRET
AN018202-0708 Page 8 of 9
Using the Z8 Encore!® MCU as a Frequency Counter
As used herein
Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)
support or sustain life and whose failure to perform when properly used in accordance with instructions for
use provided in the labeling can be reasonably expected to result in a significant injury to the user. A
critical component is any component in a life support device or system whose failure to perform can be
reasonably expected to cause the failure of the life support device or system or to affect its safety or
effectiveness.
Document Disclaimer
©2008 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices,
applications, or technology described is intended to suggest possible uses and may be superseded. ZILOG,
INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY
OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT.
Z I L O G A L S O D O E S N O T A S S U M E L I A B I L I T Y F O R I N T E L L E C T U A L P R O P E RT Y
INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR
TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this
document has been verified according to the general principles of electrical and mechanical engineering.
Z8, Z8 Encore!, and Z8 Encore! XP are registered trademarks of Zilog, Inc. All other product or service
names are the property of their respective owners.
AN018202-0708 Page 9 of 9
9