Z8FS040 ZMOTIONTM Detection and Control Family Featuring PIR Technology Product Specification PS028511-0112 Copyright (c)2012 Zilog, Inc. All rights reserved. www.zilog.com ZMOTIONTM Detection and Control Family Product Specification ii Warning: DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG'S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION. 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 (c)1/17/12 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. Zilog ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY 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. ZMOTION and Z8 Encore! XP are registered trademarks of Zilog, Inc. All other product or service names are the property of their respective owners. PS028511-0112 Disclaimer ZMOTIONTM Detection and Control Family Product Specification iii Revision History Each instance in the revision history table reflects a change to this document from its previous revision. For more details, refer to the corresponding pages or appropriate links provided in the table below. Date Revision Level Description Page Dec 2011 11 Updated to include two new Nicera lenses in the Lens and PIR Sensor Selector. 40 Jan 2011 10 Modifications to some lens/sensor descriptions in Lens Selection Guide. 55 Jan 2011 09 Updated to include two new Nicera lenses in the Lens and PIR Sensor Selector. 40 Jan 2011 08 Updated to correct part number on title page. i Nov 2010 07 Updated to comply with accepted Zilog style. All Nov 2010 06 Updated to new Zilog/IXYS logo. All Oct 2010 05 Replaced all instances of ePIR with advanced passive infrared. All Sep 2010 04 Fixed formatting and pagination issues. All Sep 2010 03 Replaced Zilog logos, ePIR with ZMOTION, and Zdots with Module. All Oct 2008 02 Updated the Related Documents section (changed 88-pin SOIC to 28-pin SOIC for Z8FS040AHJ20SG). Removed references to GP and General Purpose. Oct 2008 01 Original issue. PS028511-0112 42, all All Revision History ZMOTIONTM Detection and Control Family Product Specification iv Table of Contents Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .iii List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Z8FS040 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 MCU Part Selection Guide and Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Pin Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 RAM Memory Map (Register Files) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Peripheral Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Pin Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Hardware Connection Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Zilog's PIR Technology and API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Standard API Register Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Advanced API Register Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Ordering Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Related Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Appendix A. Application Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-Pin Z8FS040xSB20EG MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-Pin Z8FS040xHH20EG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Pyroelectric Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dual Pyroelectric Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28-Pin Z8FS040xHJ20EG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Pyroelectric Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dual Pyroelectric Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 43 44 44 45 46 46 48 Appendix B. PIR Engine Initialization and Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Appendix C. Software Support Files and Project Configuration . . . . . . . . . . . . . . . . . . 53 ZDS II Project Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Appendix D. Lens Selection Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Customer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 PS028511-0112 Table of Contents ZMOTIONTM Detection and Control Family Product Specification vi List of Figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. Figure 11. Figure 12. Figure 13. PS028511-0112 Z8FS040 MCU Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8-Pin SOIC Package Diagram - Z8FS040xSB20EG . . . . . . . . . . . . . . . . . . 5 20-Pin SSOP Package Diagram - Z8FS040xHH20EG . . . . . . . . . . . . . . . . . 5 28-Pin SSOP Package Diagram - Z8FS040xHJ20EG . . . . . . . . . . . . . . . . . 6 Z8FS040 MCU Program Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Z8FS040 MCU RAM Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Required Circuit Connections for the Z8FS040xSB20EG(8-Pin) Motion Detection MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Required Circuit Connections for the Z8FS040xHH20EG (20-Pin) Motion Detection MCU in Single Pyro Mode . . . . . . . . . . . . . . . 45 Required Circuit Connections for the Z8FS040xHH20EG (20-Pin) Motion Detection MCU in Dual Pyro Mode . . . . . . . . . . . . . . . . . 46 Required Circuit Connections for the Z8FS040xHJ20EG (28-Pin) Motion Detection MCU in Single Pyro Mode . . . . . . . . . . . . . . . 47 Required Circuit Connections for the Z8FS040xHJ20EG (28-Pin) Motion Detection MCU in Dual Pyro Mode . . . . . . . . . . . . . . . . . 48 Application Flow Diagram: Normal Scan Rate . . . . . . . . . . . . . . . . . . . . . . 51 Application Flow Diagram: Low Scan Rate . . . . . . . . . . . . . . . . . . . . . . . . 52 List of Figures ZMOTIONTM Detection and Control Family Product Specification vii List of Tables Table 1. Table 2. Table 3. Table 4. Table 5. Table 6. Table 7. Table 8. Table 9. Table 10. Table 11. Table 12. Table 13. Table 14. Table 15. Table 16. Table 17. Table 18. Table 19. Table 20. Table 21. Table 22. Table 23. Table 24. Table 25. Table 26. Table 27. Table 28. Table 29. Table 30. Table 31. Table 32. Table 33. PS028511-0112 Z8FS040 MCU Package Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 PIR Technology Revision Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Z8FS040 MCU Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Peripheral Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 PIR Engine Standard API Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 PIR Engine Enable Register (ePIR_Enable). . . . . . . . . . . . . . . . . . . . . . . . . . 21 PIR Software Enable Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 PIR Sensitivity Register (ePIR_Sensitivity) . . . . . . . . . . . . . . . . . . . . . . . . . . 22 PIR Status/Control Register 0 (ePIR_SC0) . . . . . . . . . . . . . . . . . . . . . . . . . . 23 PIR Status/Control Register 1 (ePIR_SC1) . . . . . . . . . . . . . . . . . . . . . . . . . . 25 PIR Status/Control Register 2 (ePIR_SC2) . . . . . . . . . . . . . . . . . . . . . . . . . . 27 PIR Status/Control Register 3 (ePIR_SC3), 28-Pin SSOP . . . . . . . . . . . . . . . 27 PIR Status/Control Register 3 (ePIR_SC3), 20-Pin SSOP . . . . . . . . . . . . . . . 28 PIR Status/Control Register 3 (ePIR_SC3), 8-Pin SOIC . . . . . . . . . . . . . . . . 28 PIR ADC Result Value (ePIR_ADC_Result). . . . . . . . . . . . . . . . . . . . . . . . . 30 PIR Version (ePIR_Version) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 PIR Engine Advanced Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 PIR Advanced Status/Control Register 0 (ePIR_ASC0) . . . . . . . . . . . . . . . . 32 PIR Advanced Status/Control Register 2 (ePIR_ASC2) . . . . . . . . . . . . . . . . 33 PIR Process Rate (ePIR_Process_Rate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 PIR Sample Size Register (ePIR_Sample_Size). . . . . . . . . . . . . . . . . . . . . . . 35 PIR Debounce Time Register (ePIR_Debounce) . . . . . . . . . . . . . . . . . . . . . . 35 PIR Debounce Batch Size Register (ePIR_Debounce_Batch) . . . . . . . . . . . . 36 PIR Transient Sensitivity Level (ePIR_Transient_Sense) . . . . . . . . . . . . . . . 36 Noise Sensitivity as determined by Window Size . . . . . . . . . . . . . . . . . . . . . 37 PIR Noise Sensitivity Level (ePIR_Noise_Sense) . . . . . . . . . . . . . . . . . . . . . 37 PIR Signal (ePIR_Signal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 PIR DC Signal Level (ePIR_Signal_DC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Part Number Designations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Positions 1-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Positions 5-8: MCU and MCU Package Selector* . . . . . . . . . . . . . . . . . . . . 40 Positions 9-12: Lens and PIR Sensor Selector . . . . . . . . . . . . . . . . . . . . . . . . 40 Position 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 List of Tables ZMOTIONTM Detection and Control Family Product Specification viii Table 34. PIR Sensor Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Table 35. ZMOTION Lens and Pyroelectric Sensor Selection Guide . . . . . . . . . . . . . . 55 PS028511-0112 List of Tables ZMOTIONTM Detection and Control Family Product Specification 1 Overview Zilog's ZMOTION Detection and Control Family of products provides an integrated and flexible solution for motion detection applications based on Passive Infrared (PIR) technology, including a high-performance ZMOTION microcontroller with integrated motion detection algorithms and a selection of lenses and PIR sensors to fit a wide range of application requirements. Optimized configuration parameters for the MCU are provided for each lens/sensor combination to ensure the best possible performance while significantly reducing development risk and minimizing time to market. Depending upon your application requirements, the ZMOTION Detection and Control Family offers a broad range of solutions, from a simple combination of the Z8FS040 MCU and an API to a full set of pyros and lenses that are bundled with the Z8FS040 MCU. The ZMOTION MCU is also packaged as a complete motion detection solution, the ZMOTION Module. Zilog's Z8FS040 MCU combines the programmability and rich peripheral set of Zilog's Z8 Encore! XP(R) Flash MCUs with built-in motion detection software algorithms to provide the functions necessary for PIR motion detection applications. These motion detection algorithms comprise Zilog's PIR technology and run in the background while control and status of the PIR Engine is accessed through a software API. As a result, the designer can create application-specific software while taking advantage of Zilog's ZMOTION Motion Detection Technology. API settings are provided to match the Engine operation to each of the lens and pyroelectric sensor combinations provided. The Flash in-circuit programming capability of the Z8FS040 allows for faster development time, more flexible manufacturing and firmware changes in the field. Zilog's PIR motion detection technology provides a dramatic improvement in both sensitivity and stability over traditional designs and is scalable to many market segments including Lighting Control, HVAC, Access Control, Vending, Display, Proximity, Power Management, Occupancy Sensing and many others. Features Key features of the Z8FS040 MCU include: * * * * PS028511-0112 High performance eZ8(R) CPU core 4 KB in-circuit programmable Flash available for application code Single-pin debug with unlimited breakpoints Flexible clocking scheme Overview ZMOTIONTM Detection and Control Family Product Specification 2 PS028511-0112 * * * * * * * Internal precision oscillator running at 5.53 MHz * * * * Watchdog timer (WDT) with dedicated internal oscillator * * * * * * * Zilog's PIR technology controlled and monitored through software API registers External oscillator operating up to 20 MHz Sigma Delta ADC Up to 6 channels single-ended or 3 channels differential available On-chip analog comparator with independent programmable reference voltage Full-duplex UART with dedicated BRG Two 16-bit timers with input capture, output compare, and PWM capability (11 modes total) Up to 20 vectored interrupts 6 to 25 I/O pins depending upon package 2.7 V to 3.6 V operating voltage with extended operating temperature range -40C to +105C Select from an assortment of lenses and pyroelectric sensors to best fit your application API settings provided for each lens and pyroelectric sensor combination Directly supports 1 or 2 pyroelectric sensors Sensitivity control, range control and directional detection Extended detection modes for occupancy sensing Low power modes Features ZMOTIONTM Detection and Control Family Product Specification 3 Z8FS040 MCU Block Diagram Figure 1 displays a block diagram of the Z8FS040 MCU. PIR Engine Register File RAM (256B) + API Flash Controller 4KB Flash Memory Interrupt Controller POR & VBO WDT + Low Power Oscillator eZ8 CPU External XTAL/RC Oscillator TM On-Chip Debug Oscillator Control 5.53 MHz Internal Oscillator Program Memory Bus Register File Bus UART & BRG Timer 0 Comp VREF Timer 1 Comparator IrDA ADC VREF On-Chip Peripheral Power Control Sigma/Delta ADC GPIO Figure 1. Z8FS040 MCU Block Diagram PS028511-0112 Z8FS040 MCU Block Diagram ZMOTIONTM Detection and Control Family Product Specification 4 MCU Part Selection Guide and Reference The ZMOTION MCU is packaged in three forms to suit differing application requirements, as follows: The ZMOTION Dedicated Silicon and Optimized Software Solution. A general-pur- pose MCU with motion detection software and API stack. The ZMOTION Module. A complete modular system with a lens and pyroelectric sensor for out-of-the-box development. The ZMOTION Detection and Control Bundled Solution. A package that combines the ZMOTION MCU with an assortment of lenses and pyros. Table 1 lists these three packages by part number, while Table 2 indicates changes since the initial release of the MCU. To determine the appropriate ZMOTION product for your application by part number, see the Ordering Information section on page 39 of this document. Table 1. Z8FS040 MCU Package Availability ZMOTION MCU Part Number Z8 Encore XP Base Part Number Flash Memory GPIO ADC Channels Package Z8FS040xSB20EG Z8F082ASB020EG 4 KB 5 3 8-pin SOIC Z8FS040xHH20EG Z8F082AHH020EG 4 KB 16 4 20-pin SSOP Z8FS040xHJ20EG Z8F082AHJ020EG 4 KB 22 6 28-pin SSOP Note: x = PIR Technology Revision Identifier (see Table 2). Table 2. PIR Technology Revision Identifiers Version Part Number Engine Revision Identifier Description 1.00 A Initial release for ZEPIR0AAS01SBCG, 8-pin version only. 2.00 B ZMOTION MCU Series release features improved detection/stability, added range; low power, extended detection, dual pyro capability; advanced API features. Revised Z8FS040x part numbering schema. Please refer to the base part number in the Z8 Encore! XP F082A Series Product Specification (PS0228) for all MCU functions, features and specifications not covered in this document. PS028511-0112 MCU Part Selection Guide and Reference ZMOTIONTM Detection and Control Family Product Specification 5 Pin Configurations Zilog's Z8FS040 products are available in 8-pin SOIC and 20- and 28-pin SSOP package configurations, as shown in Figures 2 through 4. This chapter describes the signals and available pin configurations for each of these package types. For a description of the signals, see Tables 6 through 8 starting on page 21. For physical package specification information, see the Packaging section on page 39. VDD 1 8 VSS PA0/T0IN/T0OUT/XIN/DBG 2 7 PA5/TXD0/T1OUT/ANA0/CINP PA1/T0OUT/XOUT/ANA3/VREF/CLKIN 3 6 PA4/RXD0/ANA1/CINN PA2/RESET/DE0/T1OUT 4 5 ANA2 Figure 2. 8-Pin SOIC Package Diagram - Z8FS040xSB20EG PB1/ANA1 1 20 PB0/ANA0 ANA2 2 19 PC3/COUT ANA3 3 18 PC2/ANA6/LED/VREF VDD 4 17 PC1/ANA5/CINN PA0/T0IN/T0OUT/XIN 5 16 PC0/ANA4/CINP PA1/T0OUT/XOUT 6 15 DBG VSS 7 14 RESET/PD0 PA2/DE0 8 13 PA7/T1OUT PA3/CTS0 9 12 PA6/T1IN/T1OUT PA4/RXD0 10 11 PA5/TXD0 Figure 3. 20-Pin SSOP Package Diagram - Z8FS040xHH20EG PS028511-0112 Pin Configurations ZMOTIONTM Detection and Control Family Product Specification 6 ANA2 1 28 PB1/ANA1 PB4/ANA7 2 27 PB0/ANA0 PB5/VREF 3 26 PC3/COUT ANA3 4 25 PC2/ANA6 AVDD 5 24 PC1/ANA5/CINN VDD 6 23 PC0/ANA4/CINP PA0/T0IN/T0OUT/XIN 7 22 DBG PA1/T0OUT/XOUT 8 21 RESET/PD0 VSS 9 20 PC7 AVSS 10 19 PC6 PA2/DE0 11 18 PA7/T1OUT PA3/CTS0 12 17 PC5 PA4/RXD0 13 16 PC4 PA5/TXD0 14 15 PA6/T1IN/T1OUT Figure 4. 28-Pin SSOP Package Diagram - Z8FS040xHJ20EG PS028511-0112 Pin Configurations ZMOTIONTM Detection and Control Family Product Specification 7 Signal Descriptions At reset, all port pins are set to the GPIO input state on the 8-pin SOIC package except for RESET/DE0/T1OUT, which is configured to RESET, and PA0/T0IN/T0OUT/XIN/DBG, which is configured to DBG. On the 20- and 28-pin SSOP packages, RESET/PD0 is configured to RESET. Table 3 describes the Z8FS040 Series signals. Table 3. Z8FS040 MCU Signal Descriptions Signal Mnemonic I/O Description General-Purpose I/O Ports A-D PA[7:0] I/O Port A. These pins are used for general-purpose I/O. PB[5:0] I/O Port B. These pins are used for general-purpose I/O. PC[7:0] I/O Port C. These pins are used for general-purpose I/O. PD[0] O Port D. This pin is used for general-purpose output only. TXD0 O Transmit Data. This signal is the transmit output from the UART and IrDA. RXD0 I Receive Data. This signal is the receive input for the UART and IrDA. CTS0 I Clear To Send. This signal is the flow control input for the UART. DE O Driver Enable. This signal allows automatic control of external RS-485 drivers. It is approximately the inverse of the Transmit Empty (TXE) bit in the UART Status 0 Register. The DE signal can be used to ensure that the external RS-485 driver is enabled when data is transmitted by the UART. T0OUT/T1OUT O Timer Output 0-1. These signals are outputs from the timers. T0OUT/T1OUT O Timer Complement Output 0-1. These signals are output from the timers in PWM DUAL OUTPUT Mode. T0IN/T1IN I Timer Input 0-1. These signals are used as the capture, gating and counter inputs. CINP/CINN I Comparator Inputs. These signals are the positive and negative inputs to the comparator. COUT O Comparator Output. UART Controllers Timers Comparator PS028511-0112 Signal Descriptions ZMOTIONTM Detection and Control Family Product Specification 8 Table 3. Z8FS040 MCU Signal Descriptions (Continued) Signal Mnemonic I/O Description ANA[7:0] I Analog Port. These signals are used as inputs to the analog-to-digital converter (ADC). VREF I/O Analog-to-digital converter reference voltage input, or buffered output for internal reference. XIN I External Crystal Input. This is the input pin to the crystal oscillator. A crystal can be connected between it and the XOUT pin to form the oscillator. In addition, this pin is used with external RC networks or external clock drivers to provide the system clock. XOUT O External Crystal Output. This pin is the output of the crystal oscillator. A crystal can be connected between it and the XIN pin to form the oscillator. I Clock Input Signal. This pin may be used to input a TTL-level signal to be used as the system clock. O Direct LED drive capability. All port C pins have the capability to drive an LED without any other external components. These pins have programmable drive strengths set by the GPIO block. I/O Debug. This signal is the control and data input and output to and from the On-Chip Debugger. Analog Oscillators Clock Input CLKIN LED Drivers LED On-Chip Debugger DBG The DBG pin is open-drain and requires a pull-up resistor to ensure proper operation. Caution: Reset RESET I/O RESET. Generates a Reset when asserted (driven Low). Also serves as a reset indicator; the Z8 Encore! XP forces this pin low when in reset. This pin is open-drain and features an enabled internal pull-up resistor. VDD I Digital Power Supply. AVDD I Analog Power Supply. VSS I Digital Ground. AVSS I Analog Ground. Power Supply PS028511-0112 Signal Descriptions ZMOTIONTM Detection and Control Family Product Specification 9 Memory Map The Z8FS040 MCU is based on Zilog's Z8F082A device, which contains a total of 8 KB of Flash memory. Zilog's PIR technology is located in the 4 KB address range 1000h to 1FFFh, a code space that is locked and cannot be erased by the user, by the Zilog Debug Interface (ZDI) mass or page erase commands. The remaining 4 KB of this Flash memory space, in the address range 0000h to 0FFFh, is available for user application code. A memory map of the Z8SF040 MCU is illustrated in Figure 5. 1FFFh Reserved for PIR Engine 1000h 0FFFh User Application Code Space (4033 bytes) 003Eh 003Dh 0000h Interrupt Vectors and Option Bits Figure 5. Z8FS040 MCU Program Memory Map PS028511-0112 Memory Map ZMOTIONTM Detection and Control Family Product Specification 10 RAM Memory Map (Register Files) There is a total of 1 KB of RAM available on the base Z8F082A device. Some of this RAM (from 080h to 0EFh and from 190h to 3FFh) is used by Zilog's PIR technology. The remainder of the RAM, from 000h to 07Fh and from 110h to 18Fh (256 bytes) is available to the application. The MCU Control Registers are located at the top of memory, from F00h to FFFh, and are also available to the application. The area from 400h to EFFh contains no device memory. See Figure 6. FFFh F00h MCU Control Registers EFFh 400h 3FFh Reserved for PIR Engine 190h User Application RAM (128 bytes) 10Fh 100h 18Fh 110h Standard PIR API Advanced PIR API 0FFh 0F0h 0EFh Reserved for PIR Engine 080h User Application RAM (128 bytes) 07Fh 000h Figure 6. Z8FS040 MCU RAM Memory Map The PIR Motion Detection API is a series of registers located in RAM memory space, from 0F0h to 10Fh. It is through these memory locations that configuration and status are passed between the PIR technology and the user application. Advanced API registers are PS028511-0112 Memory Map ZMOTIONTM Detection and Control Family Product Specification 11 located in the address range 0F0h to 0FFh. See the Zilog's PIR Technology and API chapter on page 19 for details about the API registers and setting up the project memory environment. Peripherals The following sections describe the differences, changes, or limitations placed on any of the Z8FS040 peripherals or other functions from the base Z8F082A device. To learn more about the operation of each peripheral please refer to the appropriate section of the Z8 Encore! XP F082A Series Product Specification (PS0228). Peripheral Availability Table 4 shows how the Z8FS040 MCU peripherals are used by Zilog's PIR technology and how these peripherals differ from their counterparts on the base Z8F082A device. The peripherals used by the PIR technology should not be used by the application unless the engine is disabled through the PIR Engine Enable Register. Table 4. Peripheral Availability Device Z8FS040xSB20EG Z8FS040xHH20EG Z8FS040xHJ20EG Base MCU Device Z8F082ASB020EG Z8F082AHH020EG Z8F082AHJ020EG Pins/Package 8 pin SOIC 20-Pin SSOP 28-Pin SSOP ADC ANA2 is used for PIR sensor input. ANA3 is used for a second sensor input in DUAL PYRO Mode. ANA2 is used for PIR sensor input. ANA3 is connected to ANA6/VREF. ANA3 is used for a second sensor input and ANA6 becomes available in DUAL PYRO Mode. ANA2 is used for PIR sensor input. ANA3 is connected to VREF. ANA3 is used for a second sensor in DUAL PYRO Mode VREF Internal VREF used by the Internal VREF used by the Internal VREF used by the PIR engine and set to 1 V. PIR engine and set to 1 V. PIR engine and set to 1 V. Timer 0 Available to application. Available to application. Available to application. Timer 1 Available to application. Available to application. Available to application. PS028511-0112 Peripherals ZMOTIONTM Detection and Control Family Product Specification 12 Table 4. Peripheral Availability (Continued) GP I/O PA3/PA1 are multiplexed with ANA2/ANA3 and used for PIR sensor input (ANA2 for SINGLE PYRO Mode and ANA2/ANA3 for DUAL PYRO Mode). PB2, PB3 & PC2 are used for PIR functions. In DUAL PYRO Mode, PC2 becomes available. PB2, PB3 & PB5 are used for PIR functions. In DUAL PYRO Mode, PB5 becomes available. Low Power Op Amp Not Available Not Available Not Available Comparator Available to application. Available to application. Available to application. UART Available to application - Available to application. No CTS. Available to application. Temperature Sensor Not available. Not Available. Not Available. LED Drive -- Available to application. Available to application. WDT Available to application. Available to application. Available to application. The remainder of this section further describes the differences in application availability between the 8-pin, 20-pin and 28-pin peripheral sets. Analog to Digital Signal Conversion Zilog's PIR technology requires exclusive access to the ADC peripheral to detect motion. However, ADC conversions can be requested by the application via the API (PIR Status/ Control Register 3). If it is necessary for the user application to utilize the ADC peripheral directly, the PIR engine must first be disabled via the PIR Engine Enable Register in the API. Motion detection is not possible while the PIR engine is disabled. When the user application is finished with the ADC peripheral, it must reenable the PIR engine. 8-Pin Device. PA3 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. Therefore, ANA2 is not available for user applications. Additionally, ANA3 is used for second-sensor input in DUAL PYRO Mode. All other channels are available to the user application. ADC Channel Available to Application 0 Yes 1 Yes 2 No 3 Only in Single Pyro Mode 20-Pin Device. PB2 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. Therefore ANA2 is not available for user applications. Also, ANA3 and ANA6 are PS028511-0112 Peripherals ZMOTIONTM Detection and Control Family Product Specification 13 not available since PB3 (ANA3) must be tied directly to PC2 (ANA6/VREF). PC2 is configured as VREF output by the PIR engine. In DUAL PYRO Mode, ANA3 is used for second sensor input rather than being tied to VREF, and therefore ANA6/VREF becomes available. All other channels are available to the user application. ADC Channel Available to Application 0 Yes 1 Yes 2 No 3 No 4 Yes 5 Yes 6 Only in DUAL PYRO Mode 28-Pin Device. PB2 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. Therefore ANA2 is not available for user applications. Also, ANA3 is not available since it is tied directly to PB5/VREF. PB5 will be configured as VREF output by the PIR engine. In DUAL PYRO Mode, ANA3 is used for a second sensor input rather than being tied to VREF, and PB5 therefore becomes available. All other channels are available to the user application. PS028511-0112 ADC Channel Available to Application 0 Yes 1 Yes 2 No 3 No 4 Yes 5 Yes 6 Yes 7 Yes Peripherals ZMOTIONTM Detection and Control Family Product Specification 14 Timers There are two independent and identical 16-bit multifunction timers available; both Timer 0 and Timer 1 are available to the user application. Timer 0 8-Pin Device T0OUT not available in DUAL PYRO Mode; configured as ANA3 to support a second sensor input. All other external Timer 0 functions are available for the user application. 20-Pin Device All external Timer 0 functions are available for the user application. 28-Pin Device All external Timer 0 functions are available for the user application. Timer 1 8-Pin Device T1IN is configured as ANA2 to support the signal input from the pyroelectric sensor and is not available to the user application. All other Timer 1 functions are available. 20-Pin Device All external Timer 1 functions are available for the user application. 28-Pin Device All external Timer 1 functions are available for the user application. Watchdog Timer No changes or limitations are placed on WDT functions by Zilog's PIR technology; the WDT is available to the user application. PS028511-0112 Peripherals ZMOTIONTM Detection and Control Family Product Specification 15 Comparator 8-Pin Device The external pin that carries COUT is configured as ANA2 to support the signal input from the Pyroelectric sensor. However, the Comparator is still able to generate an interrupt internally without COUT. 20-Pin Device All external Comparator functions are available for the user application. 28-Pin Device All external Comparator functions are available for the user application. UART 8-Pin Device CTS0 is configured as ANA2 to support the signal input from the Pyroelectric sensor. It is therefore not available to the user application. The UART is still able to function correctly without /CTS when CTSE in the U0CTL0 register set to 0. 20-Pin Device All external UART functions are available for the user application. 28-Pin Device All external UART functions are available for the user application. Oscillator Control All devices can be operated with the internal 5.54 MHz IPO. For applications that require more processing power or a more accurate time base, an external crystal oscillator or ceramic resonator can be used. When using the 8-pin device, external oscillator support is limited to SINGLE PYRO Mode only, since ANA3 (the ADC input for a second pyro sensor) is multiplexed with XOUT. The 20- and 28-pin devices can be operated with an external oscillator in both SINGLE and DUAL PYRO modes. Caution: Do not operate at frequencies lower than the IPO frequency while the PIR engine is enabled or motion detection performance will be degraded. No other changes or limitations are placed on oscillator control functions by the PIR engine. PS028511-0112 Peripherals ZMOTIONTM Detection and Control Family Product Specification 16 Flash Memory The control registers associated with Flash memory are all available to the application. Zilog's PIR technology uses the value programmed into the Flash Frequency registers (FFREQ) to determine its required sample timing. The Flash Frequency High (FFREQH) and Flash Frequency Low Byte (FFREQL) registers must be programmed prior to initializing the PIR engine. These two registers combine to form a 16-bit value, FFREQ. This value is also used by the PIR 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 Interrupt Controller No changes or limitations are placed on the interrupt controller functions by Zilog's PIR technology. Temperature Sensor The temperature sensor is not tested or calibrated (trim bits are not available). Therefore this peripheral is not available on any of the Z8FS040 devices. Low-Power Operational Amplifier The AMPINP signal is multiplexed with ANA2 which is used for the pyro sensor input. Therefore this peripheral is not available on any of the Z8FS040 devices. Nonvolatile Data Storage There is no dedicated nonvolatile data storage on the Z8FS040 devices. Pin Availability Although most pins on the ZMOTION MCU Series are available to the application, some pins are dedicated to supporting the PIR functions. The following section describes which pins are reserved and which are available to the application. The pins used by Zilog's PIR technology are automatically configured when the engine is initialized. General-Purpose Input/Output All of the General Purpose I/Os are available except for those used for the PIR circuit. To learn more, see the example application schematics in Appendix A. Application Schematics on page 43. PS028511-0112 Pin Availability ZMOTIONTM Detection and Control Family Product Specification 17 8-Pin Device Pin 5 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. Any other functions multiplexed with Pin 5 (PA3/CTS0, COUT and T1IN) are not available for user applications. In DUAL PYRO Mode (the application uses 2 pyroelectric sensors), Pin 3 (ANA3) is used as an analog ADC input for second sensor and is therefore not available for other functions (T0OUT/VREF/CLKIN). 20-Pin Device Pin 2 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. In SINGLE PYRO Mode, Pin 3 (ANA3) must be externally tied to VREF on Pin 18 (PC2/ ANA6/LED/VREF). PC2 will be configured as the VREF output by the PIR engine when it is enabled. In DUAL PYRO Mode (which supports 2 pyroelectric sensors), Pin 3 (ANA3) is used for the second sensor. In this mode, the Pin 18 VREF signal is not connected externally to any other ADC inputs and is therefore available to the application (PC2/ANA6/LED/ VREF). 28-Pin Device Pin 1 (ANA2) is reserved as the analog ADC input from the pyroelectric sensor. In SINGLE PYRO Mode, Pin 4 (ANA3) must be externally tied to VREF on Pin 3 (PB5/VREF). PB5 will be configured as VREF output by the PIR engine when it is enabled. In DUAL PYRO Mode (which supports 2 pyroelectric sensors), Pin 4 (ANA3) is used for second sensor. In this mode, the Pin 3 VREF signal is not connected externally to any other ADC inputs and is therefore available to the application (PB5/VREF). PS028511-0112 Pin Availability ZMOTIONTM Detection and Control Family Product Specification 18 Hardware Connection Requirements This section describes the required external hardware connection for the ZMOTION MCU Series. Pins are automatically configured to their required function when the PIR engine is initialized via the EPIR_INIT macro. See Appendix A. Application Schematics on page 43 for example schematic diagrams showing the required connections. The device can be operated in SINGLE PYRO Mode to support one pyroelectric sensor, or DUAL PYRO Mode to support two pyroelectric sensors. Both of these modes can be operated in NORMAL or LOW SCAN RATE modes. Depending on the application, there can be up to 3 connection requirements supporting these modes: Pyroelectric Sensor (PIR Sensor). The signal from the PIR sensor is connected directly to the ANA2 input of the ADC. The ADC is configured for differential, buffered mode by Zilog's PIR technology. The sensor signal should be connected directly to the ADC input with no additional signal conditioning circuitry unless specified by the pyroelectric sensor manufacturer. ADC VREF. The on-chip VREF is configured for 1 V nominal. The PIR Sensor signal is connected to the "+" differential input of the ADC (ANA2), and the VREF signal is connected to the "-" differential input (ANA3). The 8 pin device has an internal connection from VREF to ANA3 to support this configuration therefore no external hardware connection is required. The 20 and 28 pin devices require an external connection from the VREF out signal to the ADC- (ANA3) input. Pyroelectric Passive Infrared Sensor #2. In DUAL PYRO Mode, the ADC is still used in differential, buffered mode (the same as SINGLE PYRO Mode). The signal from the second PIR sensor is connected to ANA3. The VREF signal is no longer connected to ANA3 ("-" ADC input). The fist PIR sensor is connected to the "+" ADC input (ANA2) as it is in SINGLE PYRO Mode. The VREF signal is still used internally for the ADC, but the external pin is unused in DUAL PYRO Mode. PS028511-0112 Hardware Connection Requirements ZMOTIONTM Detection and Control Family Product Specification 19 Zilog's PIR Technology and API The ZMOTION MCU Series is based on the Z8F082A MCU, a member of Zilog's Z8 Encore! XP product line, and includes the added functionality of a motion detection (PIR) engine. The PIR engine is located in the upper 4 KB area of the 8 KB device, leaving 4 KB of code space to the user application. The PIR engine operates in the background and is controlled and monitored via an Application Programmer Interface (API). The API is a series of reserved registers in memory. There are two sections to the API: Standard API Registers and Advanced API Registers. Each is described below. Standard API registers. These registers include all of the status and control functions required by most applications. These include sensitivity control, motion detection/direction status and operational modes. Advanced API registers. These registers provide additional control over the PIR engine operation and allows it to be configured to support the pyroelectric sensor and lens being used in the application. PIR Engine Timer Tick Bit 7 of PIR Status/Control Register 1 provides a 1 second time base for the PIR engine to perform house keeping operations. This bit must be set to 1, once per second by the user application. The bit is checked and cleared during the EPIR_ADC_ISR routine. PIR Engine Entry Points There are two entry points to the PIR engine that are accessed through two predefined Macros. One is an initialization macro that is used to start the engine and the other is executed upon every ADC interrupt. Both macros save and initialize the Register Pointer, perform a call to the PIR engine entry point and then restore the Register Pointer before returning control to the application. It is the responsibility of the application software to execute these macros at the appropriate time. EPIR_INIT Macro. This macro is executed to initialize the PIR engine after reset. It is nor- mally only executed once and is used in conjunction with the PIR Engine Enable register in the standard API section. The application should initialize all API registers, write the PIR Enable Pattern to the PIR Engine Enable register, and then execute this Macro. ADC conversions are started by this macro. EPIR_INIT Macro: PUSHX LDX CALL POPX PS028511-0112 RP RP, #%E0 %1FFD RP Zilog's PIR Technology and API ZMOTIONTM Detection and Control Family Product Specification 20 CPU Cycles: 261 Peripherals Initialized: ADC and GPIO depending on API selected options. ADC IRQ set for medium priority. EPIR_ADC_ISR Macro. This macro is executed for each ADC conversion. The applica- tion handles the ADC interrupt and executes this macro. All motion detection processing is performed by this macro. EPIR_ADC_ISR Macro: PUSHX LDX CALL POPX RP RP, #%E0 %1000 RP The CPU cycles used by the EPIR_ADC_ISR macro vary depending on Engine state and configuration. PIR Engine CPU Stack Usage The PIR engine shares the processor stack with the user application. There are no special requirements on the placement of the stack in memory, but it is essential that the user provide enough stack space for both the user application and the PIR engine. The PIR engine requires a maximum 6 bytes of stack. Standard API Register Set The Standard API Register Set is a series of registers implemented in the Z8FS040 RAM that allows the user code to configure and communicate with the PIR engine. The default values are loaded only when the PIR engine is enabled via the PIR Enable Register. Table 5. PIR Engine Standard API Registers API Register Name Address Mnemonic Description PIR Engine Enable Register (ePIR_Enable) 100h ePIR_Enable Enable PIR Engine PIR Sensitivity Register (ePIR_Sensitivity) 101h ePIR_Sensitivity Motion Sensitivity PIR Status/Control Register 0 (ePIR_SC0) 102h ePIR_SC0 Motion Status and Engine Mode Control PIR Status/Control Register 1 (ePIR_SC1) 103h ePIR_SC1 Engine Status and Control PIR Status/Control Register 2 (ePIR_SC2) 104h ePIR_SC2 Range Control PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 21 Table 5. PIR Engine Standard API Registers (Continued) PIR Status/Control Register 3 (ePIR_SC3) - 105h 28-Pin SSOP ePIR_SC3 ADC Scan Request PIR ADC Result Value (ePIR_ADC_Result) 10Ah/10Bh ePIR_ADC_Result ADC Scan Result PIR Version (ePIR_Version) PIR Engine Software Version 10Ch ePIR_Version Table 6. PIR Engine Enable Register (ePIR_Enable) Bit 7 6 5 Field 4 3 2 1 0 PIR Enable/Disable Pattern Control Read/Write Address 100H PIR Enable/Disable Pattern (Bits 7-0) PIR Enable/Disable Register; controlled by the application. * The PIR Enable Register controls the overall operation of the PIR engine. As an added level of protection, there are specific 8-bit enable and disable values; all other values are reserved. Reading this register returns the last value written. Once enabled, the PIR engine reads the application controlled Status/Control Register values and sets the engine controlled values to their default states. * To enable the PIR engine, first write the ePIR_ENABLE_PATTERN to the PIR Enable Register, then execute the EPIR_INIT macro. See Table 7. Table 7. PIR Software Enable Patterns Pattern Name Description 00h ePIR_DISABLE_PATTERN Disables all Engine functions, including motion detection. Used to temporarily or permanently shut down the engine. 11h ePIR_ENABLE_PATTERN Enables the PIR engine. All primary engine functions as configured in Engine Status/Control Registers are enabled. Confirmation of enabled status is provided through Engine Disabled bit in Status/Control Register 0. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 22 Table 8. PIR Sensitivity Register (ePIR_Sensitivity) Bit 7 6 5 3 2 1 0 U U U U Sensitivity Field Default 4 U U U U Control Read/Write Address 101H Sensitivity (Bits 7-0) PIR Sensitivity Setting; controlled by the application. * The PIR Sensitivity Register is used to adjust the sensitivity of the PIR engine to target motion. Lower values produce higher sensitivity to motion with 00h being the most sensitive and FFh being the least sensitive. The user application should load this register with the appropriate value to provide the appropriate sensitivity. Notes: 1. The setting of this register also affects the range of detection. Lower values increase range and higher values decrease range. 2. Depending on the lens and pyroelectric sensor used, values above 3Fh may result in very limited detection. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 23 Table 9. PIR Status/Control Register 0 (ePIR_SC0) Bit 7 Field Control 6 5 4 3 2 Extended Detection Engine Disabled MD Suspend Motion Direction Control Motion Direction R/W R R/W R/W R Address 1 0 Motion PIR Stable Detected R/W R 102H Extended Detection Level (Bits 7-6) Sets the sensitivity level of the extended detector; controlled by the application. * These 2 bits enhance the motion detection algorithms to detect slower, faster and/or more subtle motion. The Extended Detection level is selected to provide a balance between additional sensitivity while maintaining stability (no false detections). In certain applications such as lighting control the Extended Detection level can be increased after normal motion has been detected. Extended detection is dependent on the lens pattern used. Smaller lens beams tend to provide more subtle motion detection. * The Extended Detection level effects user control over the range provided in ePIR_SC2. As the Extended Detection level is increased, the Range setting becomes less effective. 00 = Extended Detection Level 0 - Minimum (least sensitive). 01 = Extended Detection Level 1. 10 = Extended Detection Level 2. 11 = Extended Detection Level 3 - High (most sensitive). Engine Disabled (Bit 5) PIR Engine Disable/Suspend Acknowledged; controlled by the PIR engine. * This bit indicates the operational status of and is controlled by the PIR engine. When the engine is initialized and enabled by loading the PIR Enable Register with the ePIR_ENABLE_PATTERN value, this bit is cleared to indicate that the Engine is ready. When the Engine is disabled by loading the PIR Enable Register with the ePIR_DISABLE_PATTERN, it will respond by setting this bit to 1 and perform no further operations until reenabled. In order for the Engine to detect that it has been disabled, the user must allow the Engine ADC interrupt to run at least once after loading the PIR Enable Register with the ePIR_DISABLE_PATTERN. 0 = Engine is enabled and operational. 1 = Engine is disabled and not operational. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 24 MD Suspend (Bit 4) Motion Detection Suspend; controlled by the application. * Temporarily suspends the PIR engine from running. This puts it in a very low processing overhead state and can be used when the application requires significant CPU processing power. While suspended, motion detection is disabled, however to ensure fast recovery from this mode, ADC interrupts still occur and samples continue to be buffered. When the application clears this bit, SUSPEND Mode is exited upon the next ADC interrupt. 0 = Normal Motion Detection. 1 = Suspended Motion Detection. Motion Direction Control (Bit 3) Motion Direction Control Enable; controlled by the application. * This bit enables directional motion detection. The relative direction of the detected motion is indicated in bit 2 (Motion Direction) of this same register. When configured as a directional detector (bit 3 set to 1), direction is indicated in bit 2 as positive or negative relative to the PIR sensor. 0 = Standard Motion Detection Mode. Motion detected in any direction. Motion Direction status bit (Bit 2) is not valid. 1 = Directional Motion Detection Mode. Motion is detected in any direction; relative direction is indicated via Motion Direction status bit (Bit 2). * The directional polarity of PIR sensors is arbitrary at the time of manufacturing. Therefore it is necessary for the user application to calibrate to each individual PIR sensor using a controlled target (i.e. moving in a known direction) and internally record the polarity to identify which polarity represents that direction. Motion Direction (Bit 2) Relative Direction of Last Motion Detected; controlled by the PIR engine. When directional motion detection is enabled, this bit indicates the relative direction of the last motion detected. When the PIR engine sets the Motion Detected bit in PIR Status Register 0, this bit is set or cleared to indicate the direction of the motion. The status is latched until the user application clears the Motion Detected bit. 0 = Last detected motion was negative. 1 = Last detected motion was positive. This status bit is undefined when Motion Direction Control is disabled. Motion Detected (Bit 1) Motion Detected on PIR Sensor Set by the PIR engine; cleared by the application. This bit indicates that the Engine has detected a motion event. The user application should routinely check this bit to determine if motion has been detected. This bit is set by the Engine and must be cleared by the user application. 0 = No motion detected by the Engine. 1 = Motion has been detected by the Engine. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 25 PIR Stable (Bit 0) Passive Infrared (PIR) sensor signal stabilized bit; controlled by the PIR engine. After periods of nonuse, the PIR sensor will take some time to stabilize before it can be used reliably. The amount of time is dependant on the PIR Sensor being used and environmental conditions and can range from a few seconds up to a minute. To relieve the application software from having to assume the worst case stabilization time, the PIR engine automatically monitors the DC offset of the PIR sensor and sets this bit when it determines that it has become stable. This bit indicates that the PIR sensor has stabilized after one of the following conditions: * After initial power on (cold start). * After reenabling the Engine via PIR Enable Register. * After returning from SLEEP Mode. 0 = PIR sensor signal is not stable, motion detected events are not valid. 1 = PIR sensor signal is stable, motion detected events are valid. Table 10. PIR Status/Control Register 1 (ePIR_SC1) Bit Field 7 6 5 4 3 Engine Timer Tick Frequency Response R/W Read/Write Control Address 2 1 0 PIR Scan Reserved Dual Pyro Rate Enable R/W 0 R/W 103H Engine Timer Tick (Bit 7) PIR One Second Timer Tick Set by the application; cleared by the PIR engine. * This bit must be set to 1 one time per second by the user application to provide the engine with a onesecond tick to perform housekeeping operations relating to motion detection. The engine will routinely poll this bit to obtain a one-second tick. This bit is cleared by the engine. 0 = Cleared by the PIR engine. 1 = A one-second interval has occurred. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 26 Frequency Response (Bits 6-3) Frequency Response of PIR engine; controlled by Application Range: 0h-Ch * This value determines the frequency response of the motion detection system. Higher values allow lower frequencies to be accepted by the PIR engine. Lower values cause the Engine to ignore targets that generate lower frequencies. These targets typically include horizontally oriented objects such as pets. * The frequency of the signal that is presented to the PIR engine is largely dependent on the structure of the PIR lens being used (number and dispersion of beams). A lens with several evenly distributed beams provides better frequency response performance than a lens with an uneven beam distribution. Note: Lower programmed values also have the effect of reducing the relative range of detection. PIR Scan Rate (Bit 2) PIR ADC conversion rate for the Pyroelectric Sensor; controlled by the application. * The PIR engine performs the necessary ADC conversions on the PIR sensor input. Each conversion generates an interrupt that is processed by the PIR engine from the EPIR_ADC_ISR macro. The PIR Scan Rate bit determines the rate at which the ADC conversions are generated. * In NORMAL SCAN RATE Mode (PIR Scan Rate set to 0), the Z8FS040 ADC peripheral is set to CONTINUOUS CONVERSION Mode, which causes a conversion to be carried out automatically every 256 system clocks. In this mode, the application is only required to execute the EPIR_ADC_ISR macro for each ADC interrupt. The ADC continually runs and continuously generates interrupts. * When LOW SCAN RATE Mode is selected by setting this bit to a 1, CONTINUOUS CONVERSION Mode is disabled and the ADC is operated in SINGLE-SHOT Mode such that each conversion takes 5129 system clocks to complete. In this mode, the application software must initiate the ADC conversion request (set bit 7 of ADCCTL0) and execute the EPIR_ADC_ISR macro once every 5mS. * In LOW SCAN RATE Mode, the ADC is disabled between conversions to reduce power consumption. Power consumption can be reduced further if the application software uses this mode in conjunction with the CPU's Halt or Stop modes. Alternately, this mode can be used to provide the application software with additional CPU processing time. * Although the LOW SCAN RATE Mode provides the application with more processing power and the opportunity for the system to reduce power consumption, the normal scan rate will provide better sensitivity and range. While operating in LOW SCAN RATE Mode, sensitivity is reduced by approximately 20%. The performance of Direction Detection may also be reduced in this mode. EMC immunity is disabled while in LOW SCAN RATE Mode. * If the PIR Scan Rate bit is changed during engine operation, the engine will stop detecting motion for up to 200mS to avoid potential false motion detection. When changing the PIR SCAN RATE Mode, the Advanced API registers must first be updated with the appropriate values. 0 = NORMAL SCAN RATE Mode 1 = LOW SCAN RATE Mode PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 27 Reserved (Bit 1) DUAL PYRO Mode (Bit 0) Dual Pyroelectric Sensor Signaling Mode; controlled by the application. * This bit determines if the PIR engine should accept signals from one or two pyroelectric sensors. * When configured for single pyro operation, only one sensor is used (connected to ANA2). When configured for dual pyro operation, the engine will scan two sensors simultaneously. DUAL PYRO Mode is typically used to provide a larger area of coverage. The second pyroelectric sensor is connected to input ANA3. In DUAL PYRO Mode, motion on either sensor will generate a motion detected event. 0 = SINGLE PYROELECTRIC SENSOR Mode. 1 = DUAL PYROELECTRIC SENSOR Mode. Table 11. PIR Status/Control Register 2 (ePIR_SC2) Bit 7 6 Field Control 5 4 3 2 1 Reserved Range Control 0 Read/Write 0 104H Address Range Control (Bits 2-0) Motion Detection Range Control; controlled by the application. * These bits determine the relative range of motion detection. Larger values decrease the range of detection. * Typical values used for Range are dependant on the lens and pyroelectric sensor being used. Range is also dependent on target size, speed, and relative temperature. For example, a range control setting that rejects one target of a particular size at a given distance does not guarantee that a larger target will be rejected at the same distance. Table 12. PIR Status/Control Register 3 (ePIR_SC3), 28-Pin SSOP Bit Field Control Address PS028511-0112 7 6 5 4 3 ANA7 Scan Request ANA6 Scan Request ANA5 Scan Request ANA4 Scan Request R/W R/W R/W R/W 2 Reserved Reserved 0 0 1 0 ANA1 Scan Request ANA0 Scan Request R/W R/W 105H Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 28 Table 13. PIR Status/Control Register 3 (ePIR_SC3), 20-Pin SSOP Bit Field 7 6 5 4 Reserved ANA6 Scan Request ANA5 Scan Request ANA4 Scan Request 0 R/W Reserved in SINGLE PYRO Mode R/W R/W Control 3 2 Reserved Reserved 0 0 1 0 ANA1 Scan Request ANA0 Scan Request R/W R/W 105H Address Table 14. PIR Status/Control Register 3 (ePIR_SC3), 8-Pin SOIC Bit Field 7 6 5 4 Reserved Reserved Reserved Reserved Control Address PS028511-0112 0 0 0 0 3 2 1 0 ANA3 Scan Request Reserved ANA1 Scan Request ANA0 Scan Request R/W Reserved in DUAL PYRO Mode 0 R/W R/W 105H Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 29 ANAx Scan Request Analog Channel 0, 1, 3-7 Scan Requested Bits Set by the application; cleared by the PIR engine. These bits allow the user application to request the Engine to perform an A/D conversion on the unreserved analog inputs. When requested, the Engine will reconfigure the appropriate I/O pin to a singleended, unbuffered input using a 2-volt reference. It will then take the next sample and store it in the PIR ADC Result Value Registers and clear all ANAx Scan Request bits. The I/O configuration for the ANAx pin is not returned to its previous configuration by the Engine. If required, the user application must perform this task. If multiple request bits are set simultaneously, the Engine will only scan the lowest numbered ADC channel requested and ignore any other requests. The user application should set one request bit then poll it to determine when the conversion is complete and the data is ready. When ADC Scan requests are being serviced by the PIR engine, ADC conversions on the PIR sensor are suspended. Therefore the user application should be careful not to continuously request ADC Scans. The Process Rate Register in the Advanced PIR Engine section can be monitored to ensure the Engine is receiving enough time to perform its required PIR Sensor ADC scans. 0 = No conversion requested/last conversion completed. 1 = Perform a conversion on this channel. PS028511-0112 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 30 Table 15. PIR ADC Result Value (ePIR_ADC_Result) Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ADC Result Value Field Read Control 10AH Address 10BH PIR ADC Result Value (Bits 15-0) ADC Scan Request Result Value Controlled by PIR engine The PIR ADC Result Value contains the result of the last application requested ADC conversion. The data format is identical to that discussed in the Z8 Encore XP Product Specification (PS0228) for registers ADCD_H and ADCD_L. Example for requesting an ANA0 Conversion: * Set bit 0 (ANA0 Scan Request) in PIR Status/Control Register 3 (ePIR_SC3). * Wait until the ANA0 Scan Request bit is cleared by the Engine. * Read the ADC conversion result from the PIR ADC Result Value register Note: Even though the ADC Result Value is a 16 bit register, atomic operations are not required since the value is only updated at the request of the application. Table 16. PIR Version (ePIR_Version) Bit 7 6 5 4 3 2 1 0 Version Field Control Read Address 10CH Version (Bits 7-0) PIR engine software version; controlled by the PIR engine. * The value stored in this register indicates the software version of the PIR engine. PS028511-0112 Value PIR Engine Software Version 03h 2.00 Standard API Register Set ZMOTIONTM Detection and Control Family Product Specification 31 Advanced API Register Set The registers listed in Table 17 are available for advanced configuration of the PIR engine. They include customizations for lens and pyroelectric sensor configurations. These registers, each described in this section, are not initialized by the PIR engine. Table 17. PIR Engine Advanced Registers API Advanced Register Name Address Mnemonic Description PIR Advanced Status/Control Register 0 (ePIR_ASC0) F0h ePIR_ASC0 EM noise and MD origin status PIR Advanced Status/Control Register 2 (ePIR_ASC2) F2h ePIR_ASC2 Window Size, Lock Level, and Window Update Rate PIR Process Rate (ePIR_Process_Rate) F3h/F4h ePIR_Process_Rate Relative Processing available to PIR engine PIR Sample Size Register (ePIR_Sample_Size) F5h ePIR_Sample_Size Controls amount of sensor signal averaging PIR Debounce Time Register (ePIR_Debounce) F6h ePIR_Debounce_Time Controls time to Debounce motion signal PIR Debounce Batch Size Register (ePIR_Debounce_Batch) F7h ePIR_Debounce_Batch Controls out of window samples required for Debounce PIR Transient Sensitivity Level F8h ePIR_Transient_Sense Sets PIR engine sensitivity to transient detection PIR Noise Sensitivity Level F9h ePIR_Noise_Sense Sets PIR engine sensitivity to noise detection PIR Signal FAh/FBh ePIR_Signal Current Pyro Sensor signal sample PIR Pyro DC Signal Level FCh/FDh ePIR_Signal_DC Current calculated Pyro Sensor DC offset PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 32 Table 18. PIR Advanced Status/Control Register 0 (ePIR_ASC0) Bit 7 6 5 Reserved Reserved Reserved 4 3 Buffer Refresh New Sample R/W R/W Field Control 0 0 Address 0 2 1 0 MD Origin EM Noise EM Detected Transient Detected R R/W R/W F0H Reserved (Bits 7-5) Buffer Refresh (Bit 4) Uses a fast-fill algorithm to quickly refill the motion detection buffers; controlled by the application. This bit is used to restart motion detection by quickly reinitializing and refilling the motion detection constructed sample buffers. This method can be used to restore motion detection after waking up from SLEEP Mode, or it can be used to help ignore external events that may cause false detections. Waking up from SLEEP Mode: If this bit is set when the EPIR_INIT macro is executed the Engine refills the constructed sample buffers with a fast fill algorithm that allows it to quickly restore motion detection. Typically, a simple external wake-up circuit would be implemented that provides an unqualified motion detection signal to wake up the MCU from SLEEP Mode (SMR). Upon SMR, the application would set the Buffer Refresh bit, execute EPIR_INIT, and then continue with normal motion detection functions for some period of time before returning to SLEEP Mode. By setting this bit prior to EPIR_INIT, the Engine buffers are filled much faster enabling it to analyze the original signal seen by the external wake-up circuit and determine if it is actual motion. Ignoring False Detection Events: If the MCU is used to control external components (LED's, relays, lights, triacs, etc.), a fluctuation on the power supply can be created as the external device is turned on or off. The Buffer Refresh bit can be used to ignore any false detection that could be created by these fluctuations. When the external device is turned on or off, the application can set the Buffer Refresh bit to effectively reset the motion detection history and therefore ignore any effect from the external device. New Sample (Bit 3) New sample available from PIR Signal High/Low Register. Set by the PIR engine, cleared by the application. * This bit indicates that the PIR engine has a new sensor signal input sample available that may be read by the application. This status is available as an advanced feature as the application is not normally required to read the sampled PIR sensor signal. The application must clear this bit when the sample has been read. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 33 MD Origin (Bit 2) Origin of last motion detection event; controlled by the PIR engine. This bit indicates how the PIR engine detected the last Motion Detected Event. When the engine sets the Motion Detected bit in PIRStatus0, it also sets this bit according to which detection engine registered the event. 0 = Normal Motion Detector. 1 = Extended Motion Detector. EM Noise Detected (Bit 1) EM Noise Detected on PIR Signal Set by the PIR engine; cleared by the application. * This bit indicates if the engine has detected noise on the PIR signal. This event is provided to the user application to indicate that an EM noise event has occurred and associated motion event(s) may have been suppressed by the engine. This bit does not have to be read for normal operation and is provided as status only. The application must clear this bit after it has been read. EM Transient Detected (Bit 0) EM Transient Detected on PIR Signal Set by the PIR engine; cleared by the application. * This bit indicates if the Engine has detected a transient on the PIR signal. This event is provided to the user application to indicate that an EM transient event has occurred and associated motion event(s) may have been suppressed by the engine. This bit does not have to be read for normal operation and is provided as status only. The application must clear this bit after it has been read. Table 19. PIR Advanced Status/Control Register 2 (ePIR_ASC2) Bit 7 Field Control Address 6 5 4 3 2 1 Lock level Window Size Window Update Rate R/W R/W R/W 0 F2H Lock Level (Bits 7-5) Controlled by the application. This parameter sets the minimum slope change in the signal that can be considered valid motion. This prevents small signal changes caused by environmental or VCC shifts from causing a false detection. Use this value in combination with PIR Sensitivity and Range Control settings to balance sensitivity and stability to the particular lens and pyroelectric sensor being used. * Smaller values allow subtle signals with lower slopes to be considered motion events at the expense of potential false motion events. * Larger values allow the system to ignore smaller signal slope changes at the expense of potentially missing smaller motion events. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 34 Window Size (Bits 4-3) Controlled by the application. This register determines the size of the control limit window. A larger window size produces more stable control limits at the cost of additional CPU usage. If a smaller window size is used, the more frequently the window can be calculated which allows it to track the signal better. 00 = Reserved 01 = Small window 02 = Medium window 03 = Large window Window Update Rate (Bits 2-0) Controlled by the application. This register determines how frequently the control limits are calculated. It is measured in PIR samples. A smaller number produces more frequent calculations which allow the control limits to track the signal better, at the cost of increased CPU usage. The valid range is 0 to 7. * The window is updated every 4 + (Window Update Rate * 2) PIR samples. Table 20. PIR Process Rate (ePIR_Process_Rate) Bit 15 14 13 12 11 9 8 7 6 5 4 3 2 1 0 PIR Process Rate Field Read Control Address 10 F3H F4H PIR Process Rate (Bits 7-0) Controlled by PIR engine The PIR Process Rate Indicator is provided by the Engine to determine if the user application process and interrupts overhead is impacting the performance of the Engine. If the Engine process rate drops significantly, its ability to detect motion can be significantly reduced. This value is typically used at the application development stage. This number gives an indication of how much CPU time the Engine is receiving. Higher numbers are better. Generally, if the process rate drops below 0080h, the ability to detect motion could be compromised. Note: The 16-bit value provided by these two 8-bit registers must be read as an atomic operation by the application. This can be ensured by either using the CPU's ATM instruction or by disabling interrupts while reading the two 8 bit registers. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 35 Table 21. PIR Sample Size Register (ePIR_Sample_Size) Bit 7 6 5 4 3 2 1 0 PIR Sample Size Field Control Read/Write Address F5H PIR Sample Size (Bits 7-0) Controlled by the application. This register controls the amount of averaging that the engine performs on the incoming PIR signal ADC samples. More averaging improves signal noise immunity at the cost of a slower sample rate. Table 22. PIR Debounce Time Register (ePIR_Debounce) Bit 7 6 Field 5 4 3 2 1 0 PIR Debounce Time Control Read/Write Address F6H PIR Debounce Time (Bits 7-0) Controlled by the application. * This register controls the amount of time that the engine will wait to fully debounce a motion signal. Longer times result in detection of subtle motion at the cost of more potential false motion detections. Valid range is from 01h to FFh. * Using a value less than the value in the PIR Sensitivity Register will result in no motion detection. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 36 Table 23. PIR Debounce Batch Size Register (ePIR_Debounce_Batch) Bit 7 6 5 4 3 2 1 0 PIR Debounce Batch Size Field Control Read/Write Address F7H Debounce Batch Size (Bits 7-0) Controlled by the application. This register determines the number of consecutive out-of-window samples required to consider the sequence a valid debounce count. The field works as a mask. Increasing the mask size (i.e. more bits set to 1) will increase the noise immunity of the engine but result in lower sensitivity to subtle motion signals. Valid values are 01h, 03h, 07h, 0Fh, 1Fh, 3Fh, 7Fh, and FFh. Table 24. PIR Transient Sensitivity Level (ePIR_Transient_Sense) Bit Field 7 6 5 4 3 2 Reserved PIR Transient Sensitivity 0 Read/Write Control Address 1 0 F8H Reserved (Bit 7) Transient Sensitivity (Bits 6-0) Controlled by the application. This register determines how sensitive the transient detection part of the engine is to sudden changes in the PIR signal. A lower number makes the engine more sensitive, at the cost of potential rejection of large signal motion (ex. warm target very close to detector). The valid range is 0 (disabled) to 64h. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 37 Table 25. PIR Noise Sensitivity Level (ePIR_Noise_Sense) Bit Field 7 6 5 4 3 2 Reserved PIR Noise Sensitivity 0 Read/Write Control 1 0 F9H Address Reserved (Bit 7) Noise Sensitivity (Bits 6-0) Controlled by the application. This register determines how sensitive the noise detection part of the engine is to random noise in the PIR signal. A lower number makes the noise detector more sensitive, at the cost of potential rejection of small-signal motion (for example, a small delta between ambient and target temperature or distant target). The valid range is 0 (disabled) to a maximum value determined by the Window Size selected in the PIR Advanced Status/Control Register 2. See Table 26. Table 26. Noise Sensitivity as determined by Window Size PS028511-0112 Window Size Max PIR Noise Sensitivity Value Typical Value Small 0Ch 08h Medium 1Dh 12h Large 46h 2D Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 38 Table 27. PIR Signal (ePIR_Signal) Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 PIR Signal Field Read Control FAH Address FBH PIR Signal (Bits 15-0) Controlled by PIR engine These registers contain the last PIR signal obtained by the engine. Each time the engine generates a new PIR signal sample it will place it in these registers and set the New Sample bit in the PIR Advanced Status/Control 0 Register. This gives the application direct visibility to the PIR generated signal for debugging purposes. Note: The 16 bit value provided by these two 8 bit registers must be read as an atomic operation by the application. This can be ensured by either using the CPU's ATM instruction or by disabling interrupts while reading the two 8 bit registers. Table 28. PIR DC Signal Level (ePIR_Signal_DC) Bit 15 14 13 12 11 9 8 7 6 5 4 3 2 1 0 PIR Signal DC Field Read Control Address 10 FCH FDH PIR Signal DC Level (Bits 15-0) Controlled by PIR engine These registers contain the last PIR signal DC Level calculated by the engine. Each time the engine generates new control limits it will place the DC component level in these registers. Note: The 16 bit value provided by these two 8 bit registers must be read as an atomic operation by the application. This can be ensured by either using the CPU's ATM instruction or by disabling interrupts while reading the two 8 bit registers. PS028511-0112 Advanced API Register Set ZMOTIONTM Detection and Control Family Product Specification 39 Packaging Zilog's ZMOTION Detection and Control Family takes advantage of the Z8FS040 MCU, which is available in the following packages: * * * 8-pin Small Outline Integrated Circuit Package (SOIC) 20-pin Small Shrink Outline Package (SSOP) 28-pin Small Shrink Outline Package (SSOP) Current diagrams for each of these packages are published in Zilog's Packaging Product Specification (PS0072), which is available free for download from the Zilog website. Ordering Information The ZMOTION Detection and Control Series comprises a number of product combinations that include the ZMOTION MCU plus a number of selectable lens and pyroelectric sensor options. Construct your part number based on the specific combination of MCU, lenses and PIR sensors you wish to order. Each character in the Zilog part numbering schema corresponds to a designated part attribute. To aid in determining the appropriate part(s) to order, Table 29 breaks down a typical ZMOTION product number (as differentiated from an MCU part number) by character position to include the specific ZMOTION product, its package, and any lens and pyro options you choose. Each of these character positions is further described in Tables 30 through 34. Table 29. Part Number Designations Position 1 2 3 4 Field Z M O T 5 6 MCU 7 8 9 MCU Package 10 Lens 11 12 PIR 13 G Selectable Options Table 30. Positions 1-4 ZMOT PS028511-0112 The ZMOTION Product Family. Packaging ZMOTIONTM Detection and Control Family Product Specification 40 Table 31. Positions 5-8: MCU and MCU Package Selector* PIR Software Revision MCU Field** (Pos 5, 6) MCU Package Field (Pos 7, 8) Occupancy, 8 pin SOIC 2.00 0B SB Z8FS040xHH20EG Occupancy, 20 pin SSOP 2.00 0B HH Z8FS040xHJ20EG Occupancy, 28 pin SSOP 2.00 0B HJ MCU Part Number Description Z8FS040xSB20EG Note: *To purchase the ZMOTION MCU alone, select the appropriate ZMOTION MCU part number from the first column of this table. **The second character in the MCU field refers to the PIR software engine revision. Table 32. Positions 9-12: Lens and PIR Sensor Selector Lens Field (Pos 9, 10) PIR Sensor* PIR Field (Pos 11, 12) Animal Alley Array (88) 0A RE200B-P 0A SDA02-54-P 0B Ceiling Mount Array (360) 0B RE200B-P 0A SBDI46-504AA 0C Ceiling Mount Array (360) 0C RE200B-P 0A SBDI46-504AA 0C Ceiling/Wall Mount Array (360) 0D RE200B-P 0A SBDI46-504AA 0C Clip-on 15mm Array (360) 1A RE200B-P 0A SBDI46-504AA 0C NCL-10IL 10mm wall mount array (70) 1B RE200B-P 0A NCL-3B 10mm wall mount array (40) 1C RE200B-P 0A NCL-3R 10mm ceiling/wall array (360) 1D RE200B-P 0A SBDI46-504AA 0C 10mm ceiling/wall array (18) 1E RE200B-P 0A Manufacturer Part Number Description Fresnel Technologies AA 0.9 GI T1 Fresnel Technologies CM 0.77 GI V3 Fresnel Technologies CM 0.77 GI V5 Fresnel Technologies CWM 0.5 GI V1 Nicera NCL-9(26) NCL-10S Note: See Table 34 for an additional description of these PIR sensors. Table 33. Position 13 G PS028511-0112 RoHS-compliant. Ordering Information ZMOTIONTM Detection and Control Family Product Specification 41 Table 34. PIR Sensor Information Manufacturer Part Number Description Nicera RE200B-P Basic Dual Element Nicera SDA02-54-P Premium Dual Element Nicera SBDI46-504AA Quad Element Refer to the ZMOTION Lens and Pyroelectric Sensor Product Specification (PS0286) for detailed descriptions about the lens and pyroelectric sensors used in the above ZMOTION products. Ordering Example The figure helps determine the part for an example 8-pin SOIC ZMOTION product bundled with an 88 Fresnel Technologies Animal Alley Array Lens and a Nicera Premium Dual Element PIR Sensor; the resulting ZMOTION product number is ZMOT0BSB0A0BG. Pos #: 1 2 3 4 Fi el d Z M O T Example Z M O T 5 6 7 IC 0 8 9 IC P KG B S 10 11 Lens B 0 A 12 PIR 0 13 G B G RoH S PIR Se nso r (SDA0 2-54 -P) Len s (AA 0.9 GI T1 ) IC Pa ckage (8 Pi n, SOIC) IC (Occup ancy, S/W Versi on 2.00 ) ZMo ti on Prod uct Fami ly To learn more about ordering the ZMOTION that's right for your application requirements, please consult your local Zilog Sales office. The Zilog Worldwide Sales Locations page on zilog.com lists all regional offices and can connect you to additional product information. PS028511-0112 Ordering Information ZMOTIONTM Detection and Control Family Product Specification 42 Related Documents Additional information can be found in the following documents, available from the Zilog website at www.zilog.com. Document Number Description AN0301 Power Management and Customer Sensing with Zilog's ZMOTION Detection Module Application Note AN0307 ZMOTION Detection Module Application Walkthrough Application Note AN0309 High Brightness LED Reference Design Application Note PB0223 ZMOTION Detection Module Product Brief PB0225 ZMOTION Detection and Control Product Brief PS0228 Z8 Encore! XPF082A Series Product Specification PS0284 ZMOTION Detection Module Product Specification PS0286 ZMOTION Lens and Pyroelectric Sensor Product Specification QS0073 ZMOTION Detection Module Evaluation Kit Quick Start Guide QS0076 ZMOTION Detection and Control Development Kit Quick Start Guide UM0223 ZMOTION Detection Module Evaluation Kit User Manual UM0230 ZMOTION Detection and Control Development Kit User Manual WP0017 A New PIR Motion Detection Architecture White Paper WP0018 ZMOTION Detection Lens and Pyro Sensor Configuration Guide PS028511-0112 Related Documents ZMOTIONTM Detection and Control Family Product Specification 43 Appendix A. Application Schematics The ZMOTION Detection and Control MCU is available in 8-pin, 20-pin and 28-pin parts and configurable with dual and quad pyro sensor and lens combinations. 8-Pin Z8FS040xSB20EG MCU Figure 10 shows an example circuit for part number Z8FS040xSB20EG, an 8-pin ZMOTION Detection and Control MCU. The interface to the pyroelectric sensor is via the dedicated input ANA2 (pin 5). The status LED is driven by pin 6 which is normally configured as a GPIO by the application to control the state of the LED. Pin 2 is used as the debug input to the chip, but can be used for other functions as required. Pin 4 is set up for the Reset function, but may also be used for other functions as the application requires. Pull-up resistors (10K) are provided on the Debug and Reset signals as required for the Debug interface. The signals on pins 3 and 7 can be used as required. The power supply design is left to the application requirements. In DUAL PYRO Mode, the second Pyroelectric sensor is connected to Pin 3 (ANA3). All other connections remain the same. PS028511-0112 Application Schematics ZMOTIONTM Detection and Control Family Product Specification 44 VDD (3 .3V) 1uF 10K 10 K 1 Debug Header VCC 1 RESET 2 GND DBG GND NC 2 VDD VSS PA 0/T0 IN/T0OUT/XIN //DBG PA5/TXD0/T1OUT/ANA0 /CINP 3 PA1/T0OU T/XOUT/ANA3/VR EF/CLKIN 4 7 PA4/RXD 0/ ANA1/ CINN 6 PA2 /RESET/D E0/T1OU T 3 8 ANA2 5 Z8FS040xSB20EG 4 VD D (3 .3V) 470 5 6 To Second Pyro Electric Sensor in Dual Pyro Mode VD D Pyro Electric Sensor Status LED SIG 1uF GN D 47K Figure 7. Required Circuit Connections for the Z8FS040xSB20EG(8-Pin) Motion Detection MCU 20-Pin Z8FS040xHH20EG The 20-pin Z8FS040xHH20EG part offers both dual and quad pyroelectric sensors; each of these modes is described in this appendix. Single Pyroelectric Sensors Figure 11 shows an example circuit for the 20 pin device of the ZMOTION Detection and Control MCU Family with a single Pyro Electric sensor. The interface to the pyroelectric sensor is via the dedicated input ANA2 (pin 2). VREF (pin 18) must be externally tied to ANA3 (pin 3). The status LED is driven by pin 19 (PC3/COUT) which is normally configured as a GPIO by the application to control the state of the LED. This pin provides a programmable constant current sink specifically for LED drive without using an external resistor. Pin 15 is dedicated as the Debug pin and is connected to pin 4 of the Debug Header. Pin 14 is set up for the Reset function, but may also be used as PD0 (general purpose I/O) as the application requires. Pull-up resistors (10K) are provided on the Debug PS028511-0112 20-Pin Z8FS040xHH20EG ZMOTIONTM Detection and Control Family Product Specification 45 and Reset signals as required for the Debug interface. All other signals may be used as required. The power supply design is left to the application requirements. VDD (3. 3V ) VDD (3.3V ) V DD (3.3V ) VDD (3 .3V ) V DD 10K 1 2 SI G 1uF Status LED Pyro Electric Sensor 3 47 K 4 GND 5 1 uF 6 7 8 9 10 PB 1/ ANA 1 PB 0/ ANA 0 ANA 2 PC 3/CO UT ANA 3 PC 2/A NA6 /LED /V R EF V DD P C 1/ ANA 5/CI NN PA 0/ T0I N/T 0OU T/X IN P C0/ ANA 4/ CI NP PA 1/T 0OUT /XO UT DB G VSS RES ET / PD0 P A 2/DE0 PA7 /T 1O UT PA 3/CT S0 PA 4/ RXD0 PA 6/ T1I N/T 1O UT PA 5/ T XD0 10 K 20 Debug Header 19 18 1 17 2 16 3 15 4 14 5 13 6 VCC RES ET GND DBG GND NC 12 11 Z8FS040xHH020EG Figure 8. Required Circuit Connections for the Z8FS040xHH20EG (20-Pin) Motion Detection MCU in SINGLE PYRO Mode Dual Pyroelectric Sensors In DUAL PYRO Mode, the second pyroelectric sensor is connected to ANA3. The signal from VREF to ANA3 is not required. All other connections remain the same as SINGLE PYRO Mode. See Figure 12. PS028511-0112 20-Pin Z8FS040xHH20EG ZMOTIONTM Detection and Control Family Product Specification 46 V DD (3. 3V) V DD (3.3V ) V DD (3. 3V ) VDD (3. 3V) VDD Status LED Pyro Electr ic Sensor 1 1 2 SIG 1uF 3 47 K GND 4 5 1 uF 6 7 8 9 V DD (3. 3V ) 10 Pyro Electr ic Sensor 2 P B 1/ ANA 1 A NA 2 PB 0/ANA 0 PC3/ COUT A NA 3 P A 0/ T 0I N/T0 OUT/ XIN 10K Debug H eader 1 2 16 3 15 4 14 5 13 6 P C0/A NA4/ CINP DB G VS S RESE T /PD0 PA 2/DE 0 P A7/ T1OUT P A4/ RXD0 10K PC1/A NA 5/ CI NN 17 PA 1/ T0OUT/ XOUT PA 3/CT S0 19 18 P C2/A NA 6/ LE D/ VR EF VDD 20 PA 6 /T1IN/ T1OUT P A5/ TXD0 VCC RESE T GND DBG GND NC 12 11 Z 8F S040xH H020EG VDD SIG 1uF 47K GND Figure 9. Required Circuit Connections for the Z8FS040xHH20EG (20-Pin) Motion Detection MCU in DUAL PYRO Mode 28-Pin Z8FS040xHJ20EG The 20-pin Z8FS040xHH20EG part offers both dual and quad pyroelectric sensors; each of these modes is described in this appendix. Single Pyroelectric Sensor Figure 13 shows an example circuit for the 28-pin device of the ZMOTION Detection and Control MCU Family with a single Pyroelectric sensor. The interface to the pyroelectric sensor is via the dedicated input ANA2 (pin 1). VREF (pin 3) must be externally tied to ANA3 (pin 4). The status LED is driven by pin 26 (PC3/COUT) which is normally configured as a GPIO by the application to control the state of the LED. This pin provides a programmable constant current sink specifically for LED drive without using an external resistor. Pin 22 is dedicated as the Debug pin and is connected to pin 4 of the Debug Header. Pin 21 is set up for the Reset function, but may also be used as PD0 (general purpose I/O) as the application requires. Pull-up resistors (10K) are provided on the Debug PS028511-0112 28-Pin Z8FS040xHJ20EG ZMOTIONTM Detection and Control Family Product Specification 47 and Reset signals as required for the Debug interface. All other signals may be used as required. The power supply design is left to the application requirements. VDD (3 .3V) VDD (3.3V ) VDD (3.3V) Pyro Electric Sensor Status LED VD D 1 SIG 1uF GN D 47K VDD (3 .3V) PB1/ANA1 28 PB0/ANA0 27 3 PB5/V R EF PC 3/C OUT 26 4 AN A3 PC2/ANA6 25 5 6 1uF AN A2 2 PB4/ANA7 7 PC1/ANA 5/CIN N AVDD VDD PC0/ANA4/CIN P PA0/T0IN/T0OU T/XIN 8 PA 1/T0 OUT/XOUT 9 10 PC 7 PC 6 AVSS PA7/T1 OUT 2 3 22 4 RESET GND DBG 5 GND 6 20 NC 19 18 PA3/CTS0 PC 5 17 PC 4 16 PA5/TXD0 1 VCC 23 13 PA 4/RXD0 14 10K 24 RESET/PD 0 21 VSS 11 PA 2/ DE0 12 DBG Debug Header 10K PA6/T1IN /T1 OUT 15 Z8FS040xHH020EG Figure 10. Required Circuit Connections for the Z8FS040xHJ20EG (28-Pin) Motion Detection MCU in SINGLE PYRO Mode PS028511-0112 28-Pin Z8FS040xHJ20EG ZMOTIONTM Detection and Control Family Product Specification 48 Dual Pyroelectric Sensors In DUAL PYRO Mode, the second pyroelectric sensor is connected to ANA3. The signal from VREF to ANA3 is not required. All other connections remain the same as SINGLE PYRO Mode. See Figure 14. V DD (3 .3V ) V DD (3.3 V) V DD (3. 3V) Pyro Electric Senso r 1 St atus LE D VDD 1 S IG 1uF 2 47K GND 3 V DD (3. 3V) 4 5 6 1 uF 7 8 9 10 Pyro Electric Sensor 2 11 V DD 12 SIG 13 14 GN D 47 K ANA 2 PB 1/A NA 1 PB 4/A NA 7 PB0 /A NA 0 PB 5/V R EF P C3/ COUT ANA 3 PC2/ ANA 6 A VDD PC1 /A NA5 /CIN N VD D PC0/ A NA4 /CIN P PA 0/ T0I N/T0OUT / XI N P A1 /T0OUT / XOUT DB G RES ET / PD0 VS S PC 7 AV SS PC 6 P A 2/DE 0 PA7 /T 1OU T P A 3/ CTS 0 PC 5 P A 4/ RXD0 PC 4 P A 5/ TX D0 PA 6 /T 1I N/T 1OUT 28 27 26 10 K 10K D ebug H eader 25 1 24 2 23 3 22 4 21 5 20 6 V CC R ESE T G ND D BG G ND NC 19 18 17 16 15 Z8F S040xHH 020EG Figure 11. Required Circuit Connections for the Z8FS040xHJ20EG (28-Pin) Motion Detection MCU in DUAL PYRO Mode PS028511-0112 28-Pin Z8FS040xHJ20EG ZMOTIONTM Detection and Control Family Product Specification 49 Appendix B. PIR Engine Initialization and Control 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 housekeeping operations and to keep track of its sampling rate. This tick must be provided by the user application through the Status/Control Register 1 (Engine Timer Tick). Once per second, this bit should be set to a 1 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 the 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 must 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 Observe the following procedure to initialize the PIR engine - a process that is common to both the Normal Scan Rate and Low Scan Rate modes: 1. Set up the API control registers (standard and advanced). 2. Initialize the FFREQH and FFREQL registers with the MCU clock frequency. 3. Write the PIR Enable Pattern to the PIR Enable Register. 4. Call PIR Init. PS028511-0112 PIR Engine Initialization and Control ZMOTIONTM Detection and Control Family Product Specification 50 5. Initialize any application-specific I/O and peripherals. 6. Enable interrupts. 7. Ensure that the PIR Sensor Stable bit (ePIR_SC0:0) is set. 8. Continue with the application. The flow diagram in Figure 15 shows the general software operation for NORMAL SCAN RATE Mode. PS028511-0112 PIR Engine Initialization and Control ZMOTIONTM Detection and Control Family Product Specification 51 RESET Initialize Oscillator & WDT Set up GPIO's for application Initialize Flash Frequency Register Enable ADC in PWRCTL0 Initialize API Registers Recommended settings supplied in lens/pyro configuration file PIR Sc an R a te = 0 e PIR Initiali za tio n Set ePIR_Enable Register to ePIR_ENABLE_PATTERN Execute ePIR_INIT Macro Enter ADC Interrupt Execute ePIR_ADC_ISR Macro A DC Inter rupt Exit ADC Interrupt Set up Timer for 1 Second Interrupt Enable Global Interrupts Application Initialization Wait for PIR Sensor Stable ePIR_SC0:0=1 HALT (Optional) Main Ap plication Loop Monitor ePIR API for Events 1 Second Timer Interrupt Set bit 7 of ePIR_SC1 (Engine Timer Tick) O ne Se cond Timer Tick Return User Application Code Figure 12. Application Flow Diagram: Normal Scan Rate PS028511-0112 PIR Engine Initialization and Control ZMOTIONTM Detection and Control Family Product Specification 52 The flow diagram in Figure 16 shows the general software operation for LOW SCAN RATE Mode. RESET Initialize Oscillator & WDT Set up GPIO's for application Enter ADC Interrupt Initializ e Flash Frequency Register Enable ADC in PWRCTL0 Turn off ADC to Cons erve Power Initialize API Registers Recommended settings supplied in lens/py ro configuration file PIR Sca n R ate = 1 ePIR Initialization ADC Interrupt Exit ADC Interrupt Set ePIR_Enable Register to ePIR_ENABLE_PATTERN Execute EPIR_INIT Macro 5 Millis econd Timer Interrupt Set up Timer for 5 Millisecond Interrupt Enable Global Interrupts Start next ADC Sample Execute EPIR_ADC_ISR Macro Application Initialization 5 Millisecond ADC Scan Wait for PIR Sensor Stable ePIR_SC0:0=1 No HALT (Optional) Main Application Loop 1 Sec ond? Yes Monitor ePIR API for Events Set bit 7 of ePIR_SC1 (Engine Timer Tic k) User Application Code Return One Second Timer Tick Figure 13. Application Flow Diagram: Low Scan Rate PS028511-0112 PIR Engine Initialization and Control ZMOTIONTM Detection and Control Family Product Specification 53 Appendix C. Software Support Files and Project Configuration The following four files are provided to support the PIR engine: ePIR_API.c. Contains the API register definitions and locates them at their appropriate places in memory. ePIR_API.h. Provides the bit definitions for the API registers and also contains the macro definitions for EPIR_INIT and EPIR_ADC_ISR. API_INIT_xx.h. This header file contains the default API settings specific to the lens and pyroelectric sensor being used. The application code loads the API registers with these values prior to executing the EPIR_INIT macro. Several versions of this file are available from the Zilog website with tested configurations supporting the available lenses and pyroelectric sensors. Refer to Appendix D. Lens Selection Guide on page 55 to select the appropriate API_INIT_xx file for the selected lens. startupePIR.asm. This is the C startup file that replaces startups.asm or startupl.asm in ZDS II. It contains the environment initialization, stack and register pointer configurations required specifically for a PIR project. ZDS II Project Settings Zilog Developer Studio (ZDS II) is used for software development. Since the compiled application code has no vision into the operation of the PIR engine, it is important to ensure that the application working RAM area is not effected by engine operations. To facilitate this, the PIR engine uses working register group E (addresses E0h to EFh) as its working RAM area and the application code uses working register group 0 (as defined in startupePIR.asm). These operations are automatically handled by the compiler and examples are provided with the available sample projects. The Small Memory Model must be used for the application software. To support the defined memory map, ZDS II project settings must be configured as follows (sample projects are available that have these settings already configured). Application Project Settings (Small Model) * PS028511-0112 RData: 20h-6Fh, F0h-FFh - Defined in ZDS II Project Settings under Linker Address Spaces - This allows for 16 bytes of stack space starting at 7Fh. If additional space is required, reduce the 6Fh value. - The compiler uses address 00h to 0Fh for working registers Software Support Files and Project Configuration ZMOTIONTM Detection and Control Family Product Specification 54 - - - PS028511-0112 Address range 10h to 1Fh is the working register group reserved for first level interrupt If more than 1 level of interrupt nesting is required by the application, the 20h must be increased by 10h for every additional nesting level. Address range F0h to FFh contains the Advanced API Registers * EData: 100h-10Fh, 110h-18Fh - Defined in ZDS II Project Settings under Linker Address Spaces - Address range 100h to 10Fh contains the Standard API Registers * SP = 80h - Defined in startupePIR.asm - First stack location is 7Fh and it grows down * RP = 00h - Defined in startupePIR.asm - The application code uses working register group 0 * __intrp = 10h - Defined in startupePIR.asm - First level interrupt uses working register group 1 * Engine RP = E0h - This is the working register group used by the PIR engine - Defined by the Engine Entry macro's EPIR_INIT and EPIR_ADC_ISR ZDS II Project Settings ZMOTIONTM Detection and Control Family Product Specification 55 Appendix D. Lens Selection Guide Use the data in Table 35 to help select the lens most appropriate to your application. The configuration file listed contains the optimal API settings for that particular lens and should be included with your ZMOTION project. Refer to the ZMOTION Lens and Pyroelectric Sensor Product Specification (PS0286) for lens usage and details. Table 35. ZMOTION Lens and Pyroelectric Sensor Selection Guide Configuration Header File Pyroelectric Sensor Part Number Description Typical Applications AA 0.9 GI T1 Lens Specification Animal Alley Array (88o) * 35.6mm x 49.9mm Flat Fresnel * 22.9mm Focal Length * 25 Meter Range * 22 equal segments Corner wall mount or very ePIR_INIT_01.h high ceiling with rectangular floor pattern * Warehouse Lighting (Bay Light) * Combined Intrusion and Lighting Control * HVAC RE200B-P ePIR_INIT_02.h RE200B-P CM 0.77 GI V3 Ceiling Mount Array (360o) Lens Specification * 37mm diameter circular lens * 19.6mm focal length * 3.7m radius at 2.4m height * 3:1 floor coverage diameter to height ratio Ceiling Mount for standard commercial heights * Lighting Control * HVAC Control * Meeting rooms CM 0.77 GI V5 Ceiling Mount Array (360o) Lens Specification * 37mm diameter circular lens * 19.6mm focal length * 12.2m radius at 12.2m height * 2:1 floor coverage diameter to height ratio ePIR_INIT_03.h High ceiling mount for commercial and industrial applications * Commercial Lighting Control * Commercial HVAC Control PS028511-0112 SDA02-54-P SBDI46-504AA RE200B-P SBDI46-504AA Lens Selection Guide ZMOTIONTM Detection and Control Family Product Specification 56 Table 35. ZMOTION Lens and Pyroelectric Sensor Selection Guide (Continued) Configuration Header File Pyroelectric Sensor Ceiling/Wall Mount Array Wall or ceiling mount for office or meeting room (180o) * Room Lighting and * Circular lens with HVAC Control 24mm x 24mm square base * 14.2mm focal length * Board mount clip-in ePIR_INIT_04.h RE200B-P Clip-on 15mm Array (360o) * Clips on to pyroelectric sensor * 2.25m radius at 2m height * 2.1:1 Floor coverage diameter to height ratio Room Occupancy and Proximity Sensing * Lighting Control * HVAC Control * Appliance * Kiosk/Display Control * Vending Power Management Appliance * Power Management ePIR_INIT_05.h 10mm wall mount array (60 x 60) * Clips on to pyroelectric sensor * 4 beams (X); 2 beams (Y) * 10m range Proximity or Entrance Detection * Kiosk * Vending * HVAC * Display counters ePIR_INIT_06.h RE200B-P NCL-10IL Lens 10mm Wall/Ceiling Mount Specification Array (80 x 30) * Clips on to pyroelectric sensor * 6 beams (X); 2 beams (Y) * 10m range Proximity or Entrance Detection * Kiosk * Vending * HVAC * Display counters ePIR_INIT_07.h RE200B-P Part Number Description CWM 0.5 GI V1 Lens Specification NCL-9(26) Lens Specification NCL-3B Lens Specification PS028511-0112 Typical Applications SBDI46-504AA RE200B-P SBDI46-504AA Lens Selection Guide ZMOTIONTM Detection and Control Family Product Specification 57 Table 35. ZMOTION Lens and Pyroelectric Sensor Selection Guide (Continued) Part Number Description Typical Applications NCL-3R Lens Specification 10mm ceiling/wall mount array (360) * Clips on to pyroelectric sensor * 2:1 diameter-to-height coverage * 14 zones * 5 meter range Room occupancy and proximity sensing * Lighting control * HVAC control * Appliances * Kiosk/display control * Vending power management NCL-10S Lens 10mm wall mount array Specification (18) * Clips on to pyroelectric sensor * 2 beams X (27) * 1 beam Y (18) * 10 meter range PS028511-0112 Configuration Header File Pyroelectric Sensor ePIR_INIT_08.h RE200B-P SBDI46-504AA ePIR_INIT_09.h Entrance detection with directional detection * Kiosk/display counters * Vending * HVAC * Entrance/access control RE200B-P Lens Selection Guide ZMOTIONTM Detection and Control Family Product Specification 57 Customer Support To share comments, get your technical questions answered, or report issues you may be experiencing with our products, please visit Zilog's Technical Support page at http://support.zilog.com. To learn more about this product, find additional documentation, or to discover other facets about Zilog product offerings, please visit the Zilog Knowledge Base or consider participating in the Zilog Forum. This publication is subject to replacement by a later edition. To determine whether a later edition exists, please visit the Zilog website at http://www.zilog.com. PS028511-0112 Customer Support Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: ZiLOG: ZMOT0BSB0A0AG ZMOTIONL100ZCOG