English
Language : 

Z8FS040 Datasheet, PDF (51/56 Pages) Zilog, Inc. – ZMOTION Detection and Control Family Featuring Zilog’s PIR Technology
ZMOTIONTM Detection and Control Family
Product Specification
Appendix B
PIR Engine Initialization and Control
Description
The application software must execute an initialization procedure to enable the PIR engine. Once the
PIR engine is enabled, it runs in the background from the ADC interrupt. Every ADC conversion
generates an interrupt and the PIR engine performs its functions during this time. The user application
code runs in the foreground and monitors the status through the API and performs any other functions
required for the application.
The PIR engine also requires a one-second tick to perform several house-keeping operations and to
keep track of its sampling rate. This needs to be provided by the user application through
Status/Control Register 1 (Engine Timer Tick). This bit should be set to a 1-once per second by the
application software to provide the engine with a 1-second time base. The accuracy of this time is not
critical, but should be within +/- 10%.
There are two basic modes in which the PIR engine operates: Normal Scan Rate mode and Low Scan
Rate mode. See description of the PIR Scan Rate bit in the PIR Status/Control Register 1 for more
details.
The PIR engine runs in the background from the ADC interrupt (initiated by the application). Engine
processing is done during the ADC interrupt. Therefore CPU loading is based on the sample rate of
the ADC. To ensure a consistent sample rate the Engine needs to know the MCU operating frequency
(System Clock Frequency). It uses the Flash Frequency Control Registers to determine the operating
frequency which must be initialized prior to starting the Engine.
The Flash Frequency High (FFREQH) and Flash Frequency Low Byte (FFREQL) registers combine to
form a 16-bit value FFREQ primarily to control timing for Flash program and erase functions. This
value is also used by the PIR software engine to calculate the required sample rate of the ADC and
other functions. The 16-bit value for FFREQ is the System Clock Frequency in KHz and is calculated
using the following equation.
FFREQ[15:0] = {FFREQH[7:0],FFREQL[7:0]} = (System Clock Frequency)/1000
Basic steps for initializing the PIR engine – this process is common to both Normal Scan Rate and
Low Scan Rate modes:
1. Set up API control registers (standard and advanced)
2. Initialize FFREQH and FFREQL registers with MCU clock frequency
3. Write PIR Enable Pattern to PIR Enable Register
4. Call PIR Init
5. Initialize any Application specific I/O and peripherals
6. Enable interrupts
7. Ensure PIR Sensor Stable bit (ePIR_SC0:0) is set
8. Continue with application
PS028506-1110
PRELIMINARY
46