EM55000/S/L Series INTEGRATED DEVELOPMENT ENVIRONMENT USER’S GUIDE Doc. Version 5.0 (Applicable to EM55000/S/L IDE Version 2.9 & later) ELAN MICROELECTRONICS CORP. March 2009 Trademark Acknowledgments: IBM is a registered trademark and PS/2 is a trademark of IBM. Windows is a trademark of Microsoft Corporation. ELAN and ELAN logo are trademarks of ELAN Microelectronics Corporation. Copyright © 2005-2009 by ELAN Microelectronics Corporation All Rights Reserved Printed in Taiwan The contents of in this User’s Guide (publication) are subject to change without further notice. ELAN Microelectronics assumes no responsibility concerning the accuracy, adequacy, or completeness of this publication. ELAN Microelectronics makes no commitment to update, or to keep current the information and material contained in this publication. Such information and material may change to conform to each confirmed order. In no event shall ELAN Microelectronics be made responsible for any claims attributed to errors, omissions, or other inaccuracies in the information or material contained in this publication. ELAN Microelectronics shall not be liable for direct, indirect, special incidental, or consequential damages arising from the use of such information or material. The software (IDE) described in this publication is furnished under a license or nondisclosure agreement, and may be used or copied only in accordance with the terms of such agreement. ELAN Microelectronics products are not intended for use in life support appliances, devices, or systems. Use of ELAN Microelectronics product in such applications is not supported and is prohibited. NO PART OF THIS PUBLICATION MAY BE REPRODUCED OR TRANSMITTED IN ANY FORM OR BY ANY MEANS WITHOUT THE EXPRESSED WRITTEN PERMISSION OF ELAN MICROELECTRONICS. ELAN MICROELECTRONICS CORPORATION Headquarters: Hong Kong: USA: No. 12, Innovation Road 1 Hsinchu Science Park Hsinchu, TAIWAN 308 Tel: +886 3 563-9977 Fax: +886 3 563-9966 http://www.emc.com.tw Elan (HK) Microelectronics Corporation, Ltd. Flat A, 19F., World Tech Centre 95 How Ming Street, Kwun Tong Kowloon, HONG KONG Tel: +852 2723-3376 Fax: +852 2723-7780 Elan Information Technology Group (U.S.A.) PO Box 601 Cupertino, CA 95015 U.S.A. Tel: +1 408 366-8225 Fax: +1 408 366-8225 Shenzhen: Shanghai: Elan Microelectronics Shenzhen, Ltd. Elan Microelectronics Shanghai, Ltd. 3F, SSMEC Bldg., Gaoxin S. Ave. I Shenzhen Hi-tech Industrial Park (South Area), Shenzhen CHINA 518057 Tel: +86 755 2601-0565 Fax: +86 755 2601-0500 [email protected] #23, Zone 115, Lane 572, Bibo Rd. Zhangjiang Hi-Tech Park Shanghai, CHINA 201203 Tel: +86 21 5080-3866 Fax: +86 21 5080-4600 [email protected] Contents Contents 1 Introduction 1 1.1 Overview .....................................................................................................................1 1.2 IDE Hardware Introduction .........................................................................................2 1.2.1 Main Emulation Board (EMK or EMK-U) .......................................................2 1.2.2 The Verification Module....................................................................................3 1.3 Introduction to IDE Program.......................................................................................3 1.3.1 IDE Program Main User Interface ....................................................................4 1.3.1.1 Project View Window ...........................................................................4 1.3.1.2 Editor Window ......................................................................................5 1.3.1.3 Output Message Window......................................................................6 1.3.1.4 Menu Bar and its Commands................................................................6 1.3.1.5 Toolbar ..................................................................................................8 1.4 Introduction to EM55000 & EM55000L Series ICs ...................................................8 1.4.1 EM55001/EM55001L........................................................................................8 1.4.1.1 Unique Properties of EM55001/EM55001L..........................................9 1.4.2 EM55002/EM55002L........................................................................................9 1.4.2.1 Unique Properties of EM55002/EM55002L.........................................9 1.4.3 EM55100/EM55100L......................................................................................10 1.4.3.1 Unique Properties of EM55100/EM55100L.......................................10 1.4.4 EM55200/L ~ EM55551/L ..............................................................................10 1.4.4.1 Unique Properties of EM55200/L ~ EM55551/L ...............................10 1.4.5 EM55450/L ~ EM55700/L .............................................................................. 11 1.4.5.1 Unique Properties of EM55450/L ~ EM55700/L ............................... 11 1.5 Introduction to EM55000S Series ICs.......................................................................12 1.5.1 EM55003S.......................................................................................................12 1.5.1.1 Unique Properties of EM55003S ........................................................12 1.5.2 EM55005S.......................................................................................................12 1.5.2.1 Unique Properties of EM55005S ........................................................13 1.5.3 EM55007S.......................................................................................................13 1.5.3.1 Unique Properties of EM55007S ........................................................13 1.5.4 EM55009S.......................................................................................................14 1.5.4.1 Unique Properties of EM55009S ........................................................14 1.5.5 EM55012S.......................................................................................................14 1.5.5.1 Unique Properties of EM55012S ........................................................14 1.5.6 EM55015S.......................................................................................................15 1.5.6.1 Unique Properties of EM55015S ........................................................15 EM55000/S/L Series IDE User’s Guide Contents • iii Contents 2 IDE System Installation 17 2.1 System Requirements ................................................................................................17 2.1.1 Host Computer.................................................................................................17 2.1.2 External Power Source ....................................................................................17 2.1.3 Audio Speaker .................................................................................................17 2.2 IDE Hardware Installation and Setup for Emulation Mode ......................................18 2.2.1 Connecting Emulation Board with Verification Module.................................18 2.2.2 Jumpers Setup for Emulation Mode ................................................................18 2.2.2.1 EMV57000 Keypad 8 Jumpers Setup.................................................18 2.2.2.2 Kernel Chip Module Jumpers J1 and J2 (EPROM Size) Setup..........19 2.2.2.3 Kernel Chip Module Jumper J4 (Speaker Type) Setup ......................19 2.2.2.4 Kernel Chip Module Jumper J8 (Clock Type) Setup..........................19 2.2.3 Connecting IDE Hardware with Host Computer.............................................19 2.2.3.1 With EMK (Printer Port Interface) Emulation Board.........................19 2.2.3.2 With EMK-U (USB Interface) Emulation Board ...............................20 2.2.4 Power Installation............................................................................................20 2.2.5 Optional Speaker Installation (for EM55000/L) only)....................................21 2.3 IDE Setup for Stand-Alone Mode .............................................................................21 2.3.1 Connecting Kernel Chip Module to Verification Keypad ...............................21 2.3.2 Connecting Speaker (for EM55000 only) & Power ........................................22 2.3.3 Jumpers Setup for Stand Alone Mode .............................................................22 2.3.3.1 EMV57000 Keypad 8 Jumpers Setup.................................................22 2.3.3.2 Kernel Chip Module Jumpers J1 and J2 (EPROM Size) Setup..........23 2.3.3.3 Kernel Chip Module Jumper J4 (Speaker Type) Setup ......................25 2.3.3.4 Kernel Chip Module Jumper J8 (Clock Type) Setup..........................25 2.3.4 Input/Output Ports Assignment for Stand-Alone Operation............................25 2.3.4.1 EMM55000 Kernel Chip Module Version 1.0 I/O Port Assignments for Stand-Alone Operation............................................26 2.3.4.2 EMM55000 Kernel Chip Module Version 2.0 I/O Port Assignment for Stand-AloneOperation ..............................................27 2.3.4.3 EMM55000S Kernel Chip Module Version 1.0 I/O Port Assignment for Stand-AloneOperation ..............................................28 2.4 IDE Program Installation...........................................................................................29 2.5 Starting the IDE Program ..........................................................................................29 2.6 USB Driver Installation for EMK-U .........................................................................30 iv • Contents EM55000/S/L Series IDE User’s Guide Contents 3 Getting Started with IDE Program 33 3.1 Overview....................................................................................................................33 3.2 IDE Environment Source Files Format .....................................................................34 3.3 Create a New Program Project for Coding ................................................................34 3.3.1 Further Setup for “EASY” Type Project .........................................................36 3.4 Adding Source Files into Project ...............................................................................38 3.4.1 Edit and Add a New File from IDE Program Editor .......................................38 3.4.2 Add Existing File through “Add into project” Command ...............................39 3.4.3 Add Existing File from the Project View Window ..........................................40 3.4.3.1 Adding Existing Program File \ ..........................................................40 3.4.3.2 Adding Existing Speech File...............................................................40 3.5 Modifying Project Settings ........................................................................................41 3.6 Building Project .........................................................................................................42 3.7 Editing the Project Inserted Source File ....................................................................43 4 Processing ASM Programs for EM55000/L Series 45 4.1 Writing an Assembly (ASM) Program ......................................................................45 4.1.1 File Format ......................................................................................................45 4.1.1.1 File Structure.......................................................................................46 4.1.1.2 Statement Line ....................................................................................46 4.1.1.3 Section Definition ...............................................................................46 4.1.2 Control Register...............................................................................................47 4.1.2.1 STATUS (Play Flag, Timer Overflow Flag, and Carry Flag) .............47 4.1.2.2 DFLAG (Data Flag For Accessing Marked Samples and New Notes) .........................................................................................47 4.1.2.3 CFLAG (Control Flag for Mute) ........................................................47 4.1.2.4 FMODE (Flash and IR Mode) ............................................................48 4.1.2.5 TMODE (Table-Read Mode) ..............................................................48 4.1.3 I/O Registers....................................................................................................49 4.1.3.1 P2, P3, and P4 (P2, P3, and P4 Registers) ..........................................49 4.1.3.2 P2S, P3S, and P4S (P2, P3, and P4 Status Registers).........................49 4.1.4 Assembler Directives.......................................................................................50 4.1.5 Assembly Program Instruction Set ..................................................................52 4.1.5.1 Example ..............................................................................................55 EM55000/S/L Series IDE User’s Guide Contents • v Contents 5 Processing ESY Programs for EM55000/L Series 57 5.1 Writing an EASY Format® (ESY) Program .............................................................57 5.1.1 File Format ......................................................................................................57 5.1.1.1 [InputState]: ........................................................................................58 5.1.1.2 [OutputState]:......................................................................................58 5.1.1.3 [Asm]: In-EASY Assembly ................................................................59 5.1.1.4 [TimerAsm]:........................................................................................60 5.1.1.5 [Path]:..................................................................................................60 5.1.1.6 [Background]: ......................................................................................68 5.1.2 EASY Options .................................................................................................68 5.1.2.1 Initial Condition ..................................................................................68 5.1.2.2 Random ...............................................................................................68 5.1.2.3 NO_STOP ...........................................................................................68 5.1.2.4 Debounce ............................................................................................68 5.1.2.5 Hi-Res Timer.......................................................................................69 5.1.3 Usable RAM Range.........................................................................................69 5.1.4 Custom Defined Scankey Routine...................................................................69 5.1.4.1 Why Use Custom Defined Scankey Routine? ....................................69 5.1.4.2 How to Use a Custom Defined Scankey Routine ...............................70 5.2 Summary of Parameters in Path Equation .................................................................71 ® 5.3 Examples of EASY Format (ESY) Programs.........................................................74 5.4 Application Circuit ....................................................................................................80 5.4.1 EM55001/L......................................................................................................80 5.4.2 EM55002/L.....................................................................................................81 5.4.2 EM55002/L......................................................................................................82 5.4.3 EM55100/L ~ EM55700/L ..............................................................................85 6 Processing ASM Programs for EM55000S Series 91 6.1 Writing an Assembly (ASM) Program ......................................................................91 6.1.1 File Format ......................................................................................................91 6.1.1.1 File Structure.......................................................................................92 6.1.1.2 Statement Line ....................................................................................92 6.1.1.3 Section Definition ...............................................................................92 6.1.2 Control Register...............................................................................................93 6.1.2.1 STATUS (Play Flag, Timer Overflow Flag) .......................................93 6.1.2.2 FMODE (Flash Mode)........................................................................93 vi • Contents EM55000/S/L Series IDE User’s Guide Contents 6.1.3 I/O Registers....................................................................................................94 6.1.3.1 P2 (P2 Register) ..................................................................................94 6.1.3.2 P2S (P2 Status Register) .....................................................................94 6.1.3.3 P3 (P3 Register) ..................................................................................94 6.1.3.4 P3S (P3 Status Register) .....................................................................94 6.1.4 Assembler Directives.......................................................................................95 6.1.5 Assembly Program Instruction Set ..................................................................97 7 Processing ESY Programs for EM55000S Series 99 ® 7.1 Writing an EASY Format (ESY) Program .............................................................99 7.1.1 File Format ......................................................................................................99 7.1.1.1 [InputState]: ......................................................................................100 7.1.1.2 [OutputState]:....................................................................................101 7.1.1.3 [Asm]: In-EASY Assembly ..............................................................102 7.1.1.4 [TimerAsm]:......................................................................................103 7.1.1.5 [Path]:................................................................................................103 7.1.1.6 [Background]: (Not supported by EM55005S)..................................107 7.1.2 EASY Options ...............................................................................................108 7.1.2.1 Initial Condition ................................................................................108 7.1.2.2 Random .............................................................................................108 7.1.2.3 NO_STOP .........................................................................................108 7.1.2.4 Debounce ..........................................................................................108 7.1.2.5 Hi-Res Time (Not supported by EM55005S) ...................................108 7.1.3 Usable RAM Range.......................................................................................108 7.1.4 Custom Defined Scankey Routine.................................................................109 7.1.4.1 Why use Custom Defined Scankey Routine? ...................................109 7.1.4.2 How to Use a Custom Defined Scankey Routine? ...........................109 7.2 Summary of Parameters in Path Equation ............................................................... 111 ® 7.3 Example of EASY Format (ESY) Program.......................................................... 112 7.4 Application Circuits................................................................................................. 113 7.4.1 EM55003S..................................................................................................... 113 7.4.2 EM55005S/7S/9S .......................................................................................... 114 7.4.3 EM55012S/15S.............................................................................................. 116 EM55000/S/L Series IDE User’s Guide Contents • vii Contents APPENDIX A Sleep/Wake-up &Power Consumption of I/O Ports for EM55000/L Series 119 A.1 Introduction ............................................................................................................. 119 A.2 I/O Status during Wake Up and Sleep Mode........................................................... 119 A.2.1 “KEYB” Instruction with EM55100/L ~ EM55700/L ................................. 119 A.2.2 Port 1 Structure .............................................................................................120 A.2.3 Port 3 Structure .............................................................................................121 A.2.4 Port 2 Structure .............................................................................................122 A.2.5 Port 3.3 Flash-with-Volume Function...........................................................123 A.2.6 FV_ON, FV_OFF, and Output Setting in EASY Format® ..........................123 A.2.7 Mode and Output in Assembly .....................................................................124 A.2.8 External Circuit for Port 1 ............................................................................124 B Sleep/Wake-up & Power Consumption of I/O Ports for EM55000S Series 125 B.1 Introduction .............................................................................................................125 B.2 I/O Status during Wake Up and Sleep Mode...........................................................125 B.2.1 Port 2 Structure .............................................................................................125 B.2.1.1 Port 2.0 Behavior - No NMOS1.......................................................126 B.2.1.2 Port 2.1 Behavior - With NMOS1....................................................126 B.2.2 Port 2.1 Flash-with-Volume Function...........................................................127 B.2.3 FV_ON, FV_OFF, and Output Setting in EASY Format® ..........................127 B.2.4 Mode and Output in Assembly .....................................................................128 C Infrared Ray (IR) Application Using EASY Format® 129 C.1 IR Description for EM55100/L ~ EM55700/L and EM55005S ~ EM55015S Series..............................................................................129 C.2 EASY Program Usage for IR..................................................................................129 C.3 IR Application Circuits ...........................................................................................131 C.4 Examples of IR Applications in EASY Format® (ESY) Program .........................132 viii • Contents EM55000/S/L Series IDE User’s Guide Contents User’s Manual Revision History Doc. Version Revision Description Date 1.0 Initial version 2001/04/15 2.0 (not recorded) 2003/07/16 3.0 (not recorded) 2004/10/07 4.0 Change IR receiver pin from P2.2 & P2.3 to P2.1 & P2.2 respectively 2005/05/11 4.1 Change IR receiver pin for EM55005S ~ EM55009S from P2.1 & P2.2 2006/03/02 to P2.2 & P2.3 respectively 5.0 Added the EM55L Series chip EM55000/S/L Series IDE User’s Guide 2009/03/6 Contents • ix Contents x • Contents EM55000/S/L Series IDE User’s Guide Chapter 1 Chapter 1 Introduction 1.1 Overview The EM55000/S/L Integrated Development Environment (IDE) is a project oriented and user-friendly emulation tool that is used to edit user application programs; coding voice files, and generates emulation/layout files for ELAN's EM55000/EM55000S/EM55000L series chips. It is a fully integrated development environment comprising of the EM55000/S/L Emulation Board/Verification Module Assembly and the EM55000/S/L IDE software program. With this integrated tool, you will be able to monitor, test, and evaluate on-line, the voice coding results, as well as modify your application programs. The final layout file can then be applied and used for the commercial production of the EM55000/EM55000S/EM55000L series IC's. Wav files (*.wav) User data (*.tbl, *.bin) Assembly module (*.asm) EPROM Data File EM55000/S/L IDE Download EM55000/S/L EMULATION / VERIFICATION MODULE (Voice / Program Data File) Figure 1-1 EM55000/S/L Integrated Development Environment (IDE) Overview EM55000/S/L Series IDE User’s Guide Introduction • 1 Chapter 1 1.2 IDE Hardware Introduction The complete set of EM55000/S/L Emulation Board/Verification Module Assembly comprises of the following hardware modules, and cables: A Main Emulation Board (Version 2.1) • Either Printer Port (EMK) or USB (EMK-U) Emulation Board is provided. A Verification Module consisting of the Kernel Chip Module (EMM55000) and a 20-Key Emulation Verification Keypad (EMV57000) A Main Emulation Board to Verification Module Interface Cable with 40-pin connectors at both ends An Emulation Board to PC interface flat cable with 26-pin (printer port) connector • Printer port (26-pin) flat cable is provided for EMK Emulation Board and USB cable for EMK-U Emulation Board. Verification Keypad (EMV57000) EMK Main Emulation Board Kernel Chip Module (EMM55000) To PC Printer Port With EMK (Printer Port Interface) Board EMK-U Main Emulation Board To PC USB Port With EMK-U (USB Interface) Board Figure 1-2 Integrated Development Environment (IDE) Major Hardware Components 1.2.1 Main Emulation Board (EMK or EMK-U) The EMK Main Emulation Board connects to the host computer through the printer port while the EMK-U Main Emulation Board interfaces through the USB connector (EMK-U USB driver installation guide is provided in Section 2.6 of this manual). The Main Emulation Board connects to the host computer through the printer port and the interface cable. The emulator houses the components that allow the IDE to perform coding without the traditional burning of EPROM‘s. This method saves time and effort in the development of voice programs for EM55000/S/L series chips. IDE supports emulation for all series of EM55000/S/L chips. You can download program and voice data from host to the Main Emulation Board. It then tests and verifies functional quality of such data in the Verification Module. 2 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 1.2.2 The Verification Module This module is an assembly of the Kernel Chip Module (EMM55000) and the 20-Key Emulation Verification Keypad (EMV57000). The Verification Module validates EM55000/S/L series chips performance with the newly developed voice and program from the Main Emulation Board. The Kernel Chip Module, which houses the kernel chip, is installed piggy-back on EMV Keypad. It has a DIP socket on its top that connects to the Main Emulation Board through a flat cable. Programmed EPROM can also be plugged on the same DIP socket for stand-alone operation. The Emulation Verification Keypad houses the keypad that is used to test the audio results (with the user-provided speaker installed) of the compiled program on the Kernel Chip Module. A 20-Key EMV Keypad is provided to meet both your simple and complex applications. The Verification Module may be operated in stand-alone configuration to evaluate a newly developed voice/melody/sound effect program loaded in an EPROM. The EPROM is directly plugged into the DIP socket on top of the Kernel Chip Module. 1.3 Introduction to IDE Program The IDE Program is a windowed coding program, designed for EM55000/S/L series chips development. It runs under WIN95/98, WinME, and WinNT environment. The program performs editing, conversions, and compilation of voice, as well as table files under various formats, such as ASM (assembly), TBL (table), and ESY (EASY) formats. NOTE When running the IDE Program under WinNT, you must manually replace the file “MSVCRT.DLL” in the Windows/System directory with the same file located in the bin directory where you have installed the IDE program. See Chapters 3 to 7 for the details on how the IDE Program should be installed and how it works under the various formats mentioned above. EM55000/S/L Series IDE User’s Guide Introduction • 3 Chapter 1 1.3.1 IDE Program Main User Interface Menu Bar Tool Bar Project Filename Project View Window Editor Window Output Message Window Status Bar Figure 1-3 IDE Program Main Window and its Workspace Environment As shown above, the IDE Program main window consisted of three standard bars (Menu, Tool, and Status bars) and three major workspace environments or child windows, namely the Project View window, Editor window, and the Output Message window. 1.3.1.1 Project View Window The Project View window is the project manager. It is where you create a new or open an existing project, add or remove source files into the project, and set option of files on the window. The root node (on top) of the window displays the project filename. The Source Files node contains the program source files. The Section Files node contains the speech source files and the following files that the IDE generates during project building: • List File: Lists the coding result in binary (.bin) and corresponds line-by-line with the source file. • Report File: Displays ROM usage status, including the Source and Section files binary results, chip’s total used and remaining memory. • Approval File: The chip ordering form based and compiled from the project for your review and approval. It contains all the information required for mass production of the chip, which includes filename, size and date of Source and Section files, checksum, etc. 4 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 The Project Options node displays the configuration of the currently opened project, such as target chip, project type, clock type, etc. 1.3.1.2 Editor Window The Editor window is the IDE Program editing tool for creating, viewing, and modifying source file. Its major features are: Colored syntax highlighting Unlimited file size Multiple files can be opened and displayed at the same time Insert and overstrike modes for editing Unlimited Undo/Redo Auto indentation Clipboard support with find and replace Drag and drop text manipulation Color Coded Syntax For your convenience in avoiding erroneous use of keywords as labels or variables, each of this syntax is color coded. The keyword, user label or symbol, comment line/block digits are displayed in unique colors for easy identification. Split Editor Window Start to drag Vertical Split Bar from this corner Start to drag Horizontal Split Bar from this corner The Editor window may be horizontally and vertically split into maximum of four panes to minimize frequent dragging of scroll bar throughout an opened large file. To split the window horizontally, simply drag the tiny split-bar at the top-right corner of the window (sandwiched Figure 1-4 “Editor” Window Split into Four Panes between the Title bar and the up-arrow of the vertical scroll bar). To split the window vertically, drag the tiny split-bar at the bottom -left corner of the window (sandwiched between the window border and the left-arrow of the horizontal scroll bar). Perform both vertical and horizontal splitting to accomplish the 4-panes split (see figure below). Double click on the horizontal split-bar to terminate horizontal splitting. Likewise, click on the vertical split-bar to terminate vertical splitting. EM55000/S/L Series IDE User’s Guide Introduction • 5 Chapter 1 1.3.1.3 Output Message Window The Output Message window displays messages announcing results of project compiling, as well as their respective error messages. 1.3.1.4 Menu Bar and its Commands File Menu New… Create a new project or source file Open… Open an existing document or project Close Close the active document or project Save/Save All Save current/all active document(s) Save as Save the active document with new filename Open/Save/Close Open/Save/Close the active project Project Binary Internal Download an existing binary file Download Print/Preview/Setup Print/preview printed format of the active document/define printer settings Recent File/Recent View list of the recently closed source Projects files/projects for quick retrieval Exit from IDE Program Exit See Chapter 3 for details on how to create a new project as well as manipulate existing ones. Edit Menu Undo/Redo Undo last edit action/Cancel last undo Cut/Copy/Paste Same as standard clipboard functions Go to Line… Move cursor to the defined line number within the active window Find… Find strings in the active window Replace… Same as standard “find & replace” editing functions 6 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 Project Menu Add into project… Add file(s) into current project New Project Create a new project Open Project… Open an existing project Save Project Save the active project together with all related data Close Project Close the active Project window Build Compile recently modified but unsaved files only (no back-up files provided) Rebuild All Compile all files regardless of their recent change status. Provides Approval form, Mask file, and back-up file Option Setting… Change project option settings View Menu Toolbars View/hide Standard Toolbar, Workspace or Output Message windows Status Bar View/hide Status Bar from the bottom of the Main Window Download Menu Melody Not in used (always dimmed) Download Binary Internal Download compiled binary Download… (*.BIN) file to the Emulation Board of the IDE hardware system Window Menu New Window Open another window of the same file you are currently editing (for split window viewing) Cascade Arrange all open files in cascade formation Tile Arrange all open files editing in tile formation Arrange Icons Arrange the minimized multiple file icons (or minimize buttons) at the bottom of the Editor window. Test.esy Filename(s) of the file(s) currently opened in the Editor window. A maximum of four filenames can be displayed EM55000/S/L Series IDE User’s Guide Introduction • 7 Chapter 1 Help Menu About EM5XDev… Provides version information of the IDE Program currently in use 1.3.1.5 Toolbar 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Figure 1-5 IDE Program Toolbar View/hide toolbar from View menu. The following are the designated function for each of the icons: 1. Create a new file (Ctrl+N) 9. Undo (Alt+Backspace) 2. Open an existing file (Ctrl+O) 10. Redo 3. Save file (Ctrl+5) 11. Find (Ctrl+F) 4. Rebuild All (F8)* 12. Build (F7) 5. Print (Ctrl+P) 13. Rebuild All (F8)* 6. Cut (Shift+Del) 14. (Not used) 7. Copy (Ctrl+C) 15. About 8. Paste (Ctrl+V) * Identical function 1.4 Introduction to EM55000 & EM55000L Series ICs EM55000 series (EM55001/55002/55100/55200~55551/55450~55700) and EM55000 series (EM55001L/55002L/55100L/55200L~55551L/55450L ~55700L) ICs are matured and established voice ICs from Elan. The following are its unique features that make these chips excel all other voice ICs on the market today: 1. Programmable 2. Powerful I/O 3. Unique embedded Tiny Controller. This controller allows arbitrary configuration of I/O and chunking of voice into sections for replay. This in turn enables the voice IC to generate complex sound and LED effect. 1.4.1 EM55001/EM55001L EM55001/EM55001L is a single channel voice IC. It contains two 2-bit I/O port (P2.0, P2.1, P3.2, P3.3), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, IR communication, and other logic functions, are easily implemented by programming through its tiny controller. 8 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 1.4.1.1 Unique Properties of EM55001/EM55001L Provides low voltage (1.85V ~ 5.5V) operation (EM55001L only) Port 2 with wake-up function, Port 3.2 with programmable IR (38 KHz carrier frequency) communication function Power down mode for energy saving Single 10Kx10 bits ROM (program ROM up to 8K, and data ROM up to 10K) Readable ROM code data Two 2-bit I/O ports (P2.0, P2.1, P3.2, P3.3) and 32x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM or 7-bit PCM synthesizer 1K~22K Hz playing speed for voice playback 15 steps volume control Fixed current D/A output to drive an externally connected transistor for audio output 1.4.2 EM55002/EM55002L EM55002/EM55002L is a single channel voice IC. It contains two 4-bit I/O port (P2, P3), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, IR communication, and other logic functions, are easily implemented by programming through its tiny controller. 1.4.2.1 Unique Properties of EM55002/EM55002L Provides low voltage (1.85V ~ 5.5V) operation (EM55002L only) Port 2 with wake-up function, Port 3.2 with programmable IR (38 KHz carrier frequency) communication function Power down mode for energy saving Single 10Kx10 bits ROM (program ROM up to 8K; data ROM up to 10K) Readable ROM code data Two 4-bit I/O ports (P2, P3) and 32x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer or 7-bit PCM synthesizer 2K~21K Hz playing speed for voice playback with interpolation 15 steps volume control A pair of green voice direct drive pins is provided to drive an externally connected speaker EM55000/S/L Series IDE User’s Guide Introduction • 9 Chapter 1 1.4.3 EM55100/EM55100L EM55100/EM55100L is a single channel voice IC. It contains one input port (P1), two 4-bit I/O port (P2, P3), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, IR communication, and other logic functions, are easily implemented by programming through its tiny controller. 1.4.3.1 Unique Properties of EM55100/EM55100L Provides low voltage (1.85V ~ 5.5V) operation (EM55100L only) Port 1/2 with wake-up function, Port 3.2 with programmable IR (38 KHz carrier frequency) communication function Power down mode for energy saving Single 16Kx10 bits ROM (program ROM up to 8K; data ROM up to 16K) Readable ROM code data One input port (P1), two 4-bit I/O ports (P2, P3), and 64x4 bits RAM Two stacks for subroutine calling 2K~21K Hz playing speed for voice playback 15 steps volume control A pair of green voice direct drive pins is provided to drive an externally connected speaker 1.4.4 EM55200/L ~ EM55551/L EM55200/L ~ EM55551/L (excluding EM55450/L, EM55500/L, & EM55550/L), are a series of single channel voice ICs. It contains one 4-bit input port (P1), two 4-bit I/O ports (P2, P3), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, IR communication, and other logic functions, are easily implemented by programming through its tiny controller. 1.4.4.1 Unique Properties of EM55200/L ~ EM55551/L Wide range of ROM, RAM: EM Series EM55200/L EM55250/L EM55300/L EM55350/L EM55400/L EM55451/L EM55551/L Total ROM size (program & 32K x 10 data) x bits 48K x 10 64K x 10 96K x 10 128K x 10 192K x 10 384K x 10 Program ROM size x bits 32K x 10 RAM size x bits 128 x 4 Provides low voltage (1.85V ~ 5.5V) operation (EM55200L ~ EM55551L only) One 4-bit input port (Port 1), two 4-bit I/O ports (Port 2, Port 3) Port 1 and Port 2 with wake-up function, Port3.2 with programmable IR (38KHz) communication function 10 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 Power down mode for energy saving Readable ROM code data One 6-bit timer overflow control Two stacks for subroutine calling 5-bit ASPCM or 7-bit PCM synthesizer 1K~21K Hz playing speed for voice playback 15 steps volume control Crystal / Ring oscillation option Reset pin available A pair of green voice direct drive pins is available to drive an externally connected speaker. These pins can also be used to provide a fix current D/A output to drive an externally connected transistor for audio output 1.4.5 EM55450/L ~ EM55700/L EM55450/L ~ EM55700/L (excluding EM55451/L & EM55551/L), are a series of single channel voice IC's that contain one 4-bit input port (P1), three 4-bit I/O ports (P2, P3, P4), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, IR communication, and other logic functions, are easily implemented by programming through its tiny controller. 1.4.5.1 Unique Properties of EM55450/L ~ EM55700/L Wide range of ROM, RAM: EM Series Total ROM size (program & data) x bits EM55450/L EM55500/L EM55550/L EM55600/L EM55650/L EM55700/L 192K x 10 Program ROM size x bits RAM size x bits 256K x 10 384K x 10 512K x 10 768K x 10 1024K x 10 32K x 10 128 x 4 Provides low voltage (1.85V ~ 5.5V) operation (EM55450/L ~ EM55700/L only) One 4-bit input port (Port 1), three 4-bit I/O ports (Port 2, Port 3, Port 4) Port 1 and Port 2 with wake-up function, Port 3.2 with programmable IR (38KHz) communication function Power down mode for energy saving Readable ROM code data One 6-bit timer overflow control Two stacks for subroutine calling 5-bit ASPCM synthesizer or 7-bit PCM synthesizer 1K~16K Hz playing speed for voice playback EM55000/S/L Series IDE User’s Guide Introduction • 11 Chapter 1 15 steps volume control Crystal /Ring oscillation option Reset pin available A pair of green voice direct drive pins is available to drive an externally connected speaker. These pins can also be used to provide a fix current D/A output to drive an externally connected transistor for audio output. 1.5 Introduction to EM55000S Series ICs The EM55000S Series (EM55003S/ EM55005S/ EM55007S/ EM55009S/ EM55012S/ EM55015S) are the newly introduced cost-down version of the EM55000 generation of ELAN’s voice ICs. These new series of economy class voice chips retains most of the popular features of its predecessors. The first chip (EM55003S) of the series has recently been released and is introduced herewith. More chips under this series will be available in the near future. 1.5.1 EM55003S Like its predecessors, the EM55003S is also a single channel voice IC. It contains one 2-bit I/O port (P2.1, P2.0), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55003S tiny controller. 1.5.1.1 Unique Properties of EM55003S Port 2 (P2.0, P2.1) with wake-up function, Pin 2.1 with flash and volume functions Power down mode for saving power consumption Single 10Kx10 bits ROM (program ROM up to 8K, data ROM to 10K) One-2 bits I/O port (P2.1, P2.0) and 32x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback 1.5.2 EM55005S Like its predecessors, the EM55005S is also a single channel voice IC. It contains two 2-bit I/O port (P3.3, P3.2, P2.1, P2.0), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55005S tiny controller. 12 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 1.5.2.1 Unique Properties of EM55005S Port 2 (P2.0, P2.1) with wake-up function Pin 3.3 with flash with volume function Port 3.2 with programmable IR (38KHz) communication function Power down mode for saving power consumption Single 16Kx10 bits ROM (program ROM up to 16k, data ROM to 16k) Two-2 bits I/O port (P3.3, P3.2, P2.1, P2.0) and 32x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Equipped with voice silence compression function Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback 1.5.3 EM55007S Like its predecessors, the EM55007S is also a single channel voice IC. It contains two 2-bit I/O port (P3.3, P3.2, P2.1, P2.0), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55007S tiny controller. 1.5.3.1 Unique Properties of EM55007S Port 2 (P2.0, P2.1) with wake-up function Pin 3.3 with flash with volume function Port 3.2 with programmable IR (38KHz) communication function Power down mode for saving power consumption Single 28Kx10 bits ROM (program ROM up to 16k, data ROM to 28k) Two-2 bits I/O port (P3.3, P3.2, P2.1, P2.0) and 48x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Equipped with voice silence compression function Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback EM55000/S/L Series IDE User’s Guide Introduction • 13 Chapter 1 1.5.4 EM55009S Like its predecessors, the EM55009S is also a single channel voice IC. It contains two 2-bit I/O port (P3.3, P3.2, P2.1, P2.0), and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55009S tiny controller. 1.5.4.1 Unique Properties of EM55009S Port 2 (P2.0, P2.1) with wake-up function Pin 3.3 with flash with volume function Port 3.2 with programmable IR (38KHz) communication function Power down mode for saving power consumption Single 32Kx10 bits ROM (program ROM up to 16k, data ROM to 32k) Two-2 bits I/O port (P3.3, P3.2, P2.1, P2.0) and 48x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Equipped with voice silence compression function Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback 1.5.5 EM55012S Like its predecessors, the EM55012S is also a single channel voice IC. It contains two 3-bit I/O port (P2.2, P2.1, P2.0 & P3.3, P3.2, P3.1) and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55012S tiny controller. 1.5.5.1 Unique Properties of EM55012S Port 2 (P2.2, P2.0, P2.1) with wake-up function Pin 3.3 with flash with volume function Port 3.2 with programmable IR (38KHz) communication function Power down mode for saving power consumption Single 44Kx10 bits ROM (program ROM up to 16k, data ROM to 44k) Two 3-bit I/O port (P2.2, P2.1, P2.0 & P3.3, P3.2, P3.1) and 64x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Equipped with voice silence compression function Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback 14 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 1 1.5.6 EM55015S Like its predecessors, the EM55015S is also a single channel voice IC. It contains two 3-bit I/O port (P2.2, P2.1, P2.0), (P3.3, P3.2, P3.1) and a tiny controller. User applications, such as section combination, trigger modes, control outputs, keyboard matrix, and other logic functions, are easily implemented by programming through the EM55015S tiny controller. 1.5.6.1 Unique Properties of EM55015S Port 2 (P2.2, P2.0, P2.1) with wake-up function Pin 3.3 with flash with volume function Port 3.2 with programmable IR (38KHz) communication function Power down mode for saving power consumption Single 48Kx10 bits ROM (program ROM up to 16k, data ROM to 48k) Two 3-bit I/O port (P2.2, P2.1, P2.0), (P3.3, P3.2, P3.1) and 64x4 bits RAM Two stacks for subroutine calling One 6-bit timer overflow control 5-bit ASPCM synthesizer Equipped with voice silence compression function Provides 3.7K, 4.2K, 5K 6K, 7.5K, 10K, and 15K Hz playing speed for voice playback EM55000/S/L Series IDE User’s Guide Introduction • 15 Chapter 1 16 • Introduction EM55000/S/L Series IDE User’s Guide Chapter 2 Chapter 2 IDE System Installation 2.1 System Requirements 2.1.1 Host Computer The IDE requires a host that meets the following configuration: IBM PC (486, Pentium, etc.) or compatible computers Win95, 98, 2000, WinME, WinNT, or WinXP NOTE If you want to run the IDE Program under WinNT, you must manually replace the file “MSVCRT.DLL” in the Windows/System directory with the same file located in the bin directory where you have installed the IDE program. 800 x 600 pixels monitor is recommended (with small fonts display is preferable) At least 10M-byte or more free hard disk space Mouse is optional but highly recommended 2.1.2 External Power Source Requires power source of +5.0VDC (power adapter or battery) to provide power for Main Emulation Board and Verification Module when IDE is connected to host for Emulation Mode operation, or to Verification Module only during Stand-Alone Mode operation. 2.1.3 Audio Speaker An 8Ω external speaker is required for audio testing of your program on EM55000 Kernel Chip Module (EMM55000). NOTE 8Ω speaker is suitable for connecting output through a transistor. 32Ω (or 16Ω) speaker is suitable for direct drive output. EM55000/S/L Series IDE User’s Guide IDE System Installation • 17 Chapter 2 2.2 IDE Hardware Installation and Setup for Emulation Mode Refer to Chapter 3 for details on Emulation Mode operation under the IDE Program. 2.2.1 Connecting Emulation Board with Verification Module IMPORTANT! Remove EPROM and external power (if installed) from the EMM55000 Kernel Chip Module. 1. Plug the 40-pin male connector of the Emulation Board to Verification Module (EMV57000) Interface Cable to the DIP socket on the Kernel Chip Module (EMM55000). 2. Then plug the other end of the interface cable to V-ROM socket on Emulation Board as illustrated in the figure below. Emulation Board to EMV Cable Verification Keypad (EMV57000) 8 Jumpers V-ROM Socket V-ROM Socket Kernel Chip Module (EMM55000) EMK-U Main Emulation Board EMK Main Emulation Board With EMK (Printer Port Interface) Board With EMK-U (USB Interface) Board Figure 2-1 IDE Hardware Environment (Emulation Board and Verification Module Assembly) 2.2.2 Jumpers Setup for Emulation Mode 2.2.2.1 EMV57000 Keypad 8 Jumpers Setup Set the 8 Jumpers position on Verification Module (EMV57000) as follows (see figure above): When your IDE Program target chip is of EM55001/L, EM55002/L. or EM55000S series, set the eight jumpers to “EM57001” position. When program target chip is one of the EM55100/L to EM55700/L chips, set the eight jumpers to “EM57100” position. Target Chip 8 Jumpers Position EM55001/L, EM55002/L, or EM55000S EM57001 EM55100/L ~ EM55700/L EM57100 18 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 2.2.2.2 Kernel Chip Module Jumpers J1 and J2 (EPROM Size) Setup Set Jumpers J1 and J2 on Kernel Chip Module (EMM55000) to 4M and 1M respectively (refer to schematic diagram under Section 2.3.4 for the location of the jumpers). 2.2.2.3 Kernel Chip Module Jumper J4 (Speaker Type) Setup Referring to schematic diagram under Section 2.3.4, position J4 on Kernel Chip Module according to the type of your installed drive speaker and the corresponding connector (“SPK” or “GSPK”) it should be connected as indicated in the following table. Output Drive Type J4 Position Connector Direct drive speaker (Green voice type) Connect DAOPT to high (VCC) Transistor drive speaker (Transistor, e.g., 8050) Connect DAOPT to low (GND) GSPK (suggested speaker impedance : 32 Ω) SPK 2.2.2.4 Kernel Chip Module Jumper J8 (Clock Type) Setup Set Jumper J8 on Kernel Chip Module (EMM55000) according to the table below to accommodate the type of your clock source (crystal or oscillator) (refer to schematic diagram under Section 2.3.4 for the location of the jumpers). Clock Source J8 Position Crystal Connect POSC to high (VCC) Oscillator (Rosc) (suggested impedance : 100 KΩ) Connect POSC to low (GND) 2.2.3 Connecting IDE Hardware with Host Computer 2.2.3.1 With EMK (Printer Port Interface) Emulation Board Speaker Printer Port EMK Main Emulation Board +5VDC Power Connector PRN-CON Connector Figure 2-2 Linking IDE Hardware (with EMK Emulation Board) to Host Computer EM55000/S/L Series IDE User’s Guide IDE System Installation • 19 Chapter 2 The IDE hardware equipped with the EMK Main Emulation Board connects to the host computer from the Emulation Board through the ELAN provided printer port flat cable. As illustrated above, the 26-pin connector at one end of the cable is plugged into the PRN-CON connector of the Main Emulation Board. At the computer side, the other end of the cable is connected to the host computer printer port. 2.2.3.2 With EMK-U (USB Interface) Emulation Board Speaker EMK-U Main Emulation Board USB Port USB Connector +5VDC Power Connector Figure 2-3 Linking IDE Hardware (with EMK-U Emulation Board) to Host Computer The IDE hardware equipped with the EMK-U Main Emulation Board connects to the host computer from the Emulation Board through the ELAN provided USB Cable. As illustrated above, the D-type connector of the USB cable is plugged into the Main Emulation Board. At computer side, the other end of the cable is connected to the host computer USB port. NOTE EMK-U USB Driver installation procedure is provided in Section 2.6 of this manual. 2.2.4 Power Installation When connected to a host computer for Emulation Mode operation, an external +5VDC power source (battery or power adapter) is required to provide power to both Main Emulation Board and the Verification Module. Power may be connected to one of the power connectors in the Main Emulation Board or Verification Module as indicated in the above figure. WARNING! Before applying power to host or emulator board, ensure that all Interface Cable connectors are properly and tightly plugged into their respective connectors to prevent damage to the equipment. 20 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 2.2.5 Optional Speaker Installation (for EM55000/L) only) To provide audio effect to your application, you may connect an 8Ω external speaker to the EMM55000 Kernel Chip Module through the connector labeled “SPK” or ”GSPK” as shown in the schematic diagram at the end of this chapter. See Section 2.2.2.3 (above) for speaker jumper (J4) proper position and connection relative to the type of speaker installed. NOTE If the playback voice sounds distorted, do one of the following: 1. Connect a resistor at “Rb” location (see schematic diagram under Section 2.3.4 for “Rb” location). 2. Check and change externally connected battery if found low in power. 2.3 IDE Setup for Stand-Alone Mode EPROM written with binary files generated by IDE Program may be tested on Verification Module (consisting of the EMV Keypad EMV57000 and Kernel Chip Module EMM55000) under stand-alone mode (without connecting to Emulation Board and PC). To test and verify layout files for EM55000/S/L series chips under stand-alone operation, pertinent jumpers on the EMV Keypad and Kernel Chip Module need to be initially setup as described in Section 2.3.3 (below) after the EPROM has been inserted. NOTE 1. You may unplug the Kernel Chip Module from EMV Keypad to facilitate installation of EPROM and other setup processes 2. EPROM must be inserted before applying power. 3. For optimum power efficiency, use CMOS EPROM with fast access time of 150ns 2.3.1 Connecting Kernel Chip Module to Verification Keypad 1. Remove the flat cable (if installed), which connects the Verification Module to the Emulation Board. 2. Plug EPROM on the Kernel Chip Module (EMM55000) DIP socket. Regardless of its size, always plug EPROM from the bottom of the socket (see figure below) 3. Plug the Kernel Chip Module into the “P10” & “P11” female socket on EMV Verification Keypad. Plug from the right end of the socket (see figure below). The last four connectors at the left end of the socket are not used. EM55000/S/L Series IDE User’s Guide IDE System Installation • 21 Chapter 2 EPROM Kernel Chip Module (EMM55000) Power Connector "P10" & "P11" Socket EMV Keypad Figure 2-4 Plugging EPROM/Kernel Chip Module into EMV Keypad 2.3.2 Connecting Speaker (for EM55000 only) & Power To provide audio effect to your application, you may connect an 8Ω external speaker to the EMM55000 Kernel Chip Module through the connector labeled “SPK” or ”GSPK” as shown in the schematic diagram at the end of this chapter. See Section 2.3.1.3 for speaker jumper (J4) proper position and connection relative to the type of speaker installed. Connect +5VDC to power (±) connector on the Kernel Chip Module (see figure above). NOTE If the playback voice sounds distorted, do one of the following: 1. Connect a resistor at “Rb” location (see schematic diagram under Section 2.3.4 for the “Rb” location). 2. Check and change externally connected battery if found low in power. After setting all the pertinent jumpers (see next sections), you may start testing your EPROM program by pressing the keys on the Verification Module Keypad. 2.3.3 Jumpers Setup for Stand Alone Mode 2.3.3.1 EMV57000 Keypad 8 Jumpers Setup When your EMV target chip is EM55001/L, EM55002/L, or EM55000S, set the 8 Jumpers to “EM57001” position. When the EMV target chip is one of the EM55100/L to EM55700/L chips, set the 8 Jumpers to “EM57100” position. Target Chip 8 Jumpers Position EM55001/L/EM55002/L or EM55000S EM57001 EM55100/L to EM55700/L EM57100 22 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 Verification Module Kernel Chip Module 8 Jumpers Figure 2-5 EMV Keypad 8 Jumpers Location 2.3.3.2 Kernel Chip Module Jumpers J1 and J2 (EPROM Size) Setup Referring to the schematic diagram under Section 2.3.4, position JP1 and the JP2 Jumpers on Kernel Chip Module according to the type and size of the EPROM in used as follows: a) If the size of EPROM is less than 4M, position the Jumpers JP1 and JP2 as shown in the table below. Note that under this configuration, the IDE Program will generate binary file (XX.BIN). EPROM Type JP1 Position 27C010 / 27C4001 JP2 Position 1M 4M 27C256 / 27C512 512K b) If the size of EPROM is “4M” or larger ("8M" or in multiple EPROM's), the Jumpers JP1 and JP2 positions and its corresponding generated binary files (XX.BIN or combination of XX.B40 - XX.B41, XX.B42 - XX.B43, or XX.B80 - XX.B81) will vary according to binary file size as described below. Applicable binary files must be separately written on each EPROM. Two 4M EPROM's When the kernel chip connects to two 4M EPROM chips, the Jumpers “JP1” and “JP2” must be at “4M” and “1M” positions respectively. The “CE” of the second EPROM connects to “CE41.” The binary files XX.B40 and XX.B41; must be separately written to the first and the second EPROM respectively. EPROM # Binary File #1 XX.B40 #2 XX.B41 EM55000/S/L Series IDE User’s Guide JP1 JP2 4M 1M CE Connection CE41 IDE System Installation • 23 Chapter 2 Three 4M EPROM's When the kernel chip connects to three 4M EPROM chips, the Jumpers “JP1” and “JP2” must be at “4M” and “1M” positions respectively. The “CE” of the second EPROM connects to “CE41,” and that of the third EPROM connects to “CE42.” The binary files XX.B40, XX.B41, and XX.B42; must be separately written to the first, second, and the third EPROM respectively. EPROM # JP1 JP2 CE Connection #1 4M #2 1M CE41 #3 CE42 Four 4M EPROM's When the kernel chip connects to four 4M EPROM chips, the Jumpers “JP1” and “JP2” must be at “4M” and “1M” positions respectively. The “CE” of the second EPROM connects to “CE41,” the “CE” of the third EPROM connects to “CE42,” and that of the fourth EPROM connects to “CE43”. The binary files XX.B40, XX.B41, XX.B42 and XX.B43; must be separately written to the first, second, third, and the fourth EPROM respectively. EPROM # JP1 JP2 CE Connection #1 - #2 4M CE41 1M #3 CE42 #4 CE43 Single 8M EPROM When the kernel chip connects to a single 8M EPROM chip, the Jumpers “JP1” and “JP2” must be at “8M” and “1M” positions respectively. The binary file XX.BIN; must be written to the EPROM. EPROM # Binary File JP1 JP2 CE Connection #1 XX.BIN 8M 1M - Two 8M EPROM's When the kernel chip connects to two 8M EPROM chips, the Jumpers “JP1” and “JP2” must be at “8M” and “1M” positions respectively. The “CE” of the second EPROM connects to “CE81”. The binary files XX.B80 and XX.B81 must be separately written to the first and the second EPROM respectively. 24 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 EPROM # Binary File #1 XX.B80 #2 XX.B81 JP1 JP2 8M 1M CE Connection CE81 NOTE You can stack the EPROM’s in piggy-back formation and bend out the CE pins that need to connect to the CE contacts on the EMM55000 Kernel Chip Module. 2.3.3.3 Kernel Chip Module Jumper J4 (Speaker Type) Setup Position J4 on Kernel Chip Module according to the type of your installed drive speaker and the corresponding connector (“SPK” or “GSPK”) it should be connected to as indicated in the following table. Output Drive Type J4 Position Connector Direct drive speaker (Green voice type) Connect DAOPT to high (VCC) Transistor drive speaker (Transistor, e.g., 8050) Connect DAOPT to low (GND) GSPK (suggested speaker impedance : 32 Ω) SPK 2.3.3.4 Kernel Chip Module Jumper J8 (Clock Type) Setup Set the jumper J8 according to the table below to accommodate the type of your clock source (crystal or oscillator). Clock Source J8 Position Crystal Connect POSC to high (VCC) Oscillator (Rosc) (suggested impedance : 100 KΩ) Connect POSC to low (GND) 2.3.4 Input/Output Ports Assignment for Stand-Alone Operation The schematic diagrams in the following Sections show the details of all port assignment for each series of the of EMM55000 Kernel Chip Modules Section 2.3.4.1 Section 2.3.4.2 Section 2.3.4.3 EMM55000 Version 1.0 EMM55000 Version 2.0 EMM55000S Version 1.0 IMPORTANT!!! The EM55000L series uses the EMM55000 Kernel Chip Modules Version 1.0 & 2.0. Care should be taken to use proper operation voltage for the ROM in use. That is, the kernel chip voltage should be adjusted accordingly to accommodate ROM requiring high operation voltage. EM55000/S/L Series IDE User’s Guide IDE System Installation • 25 Chapter 2 2.3.4.1 EMM55000 Kernel Chip Module Version 1.0 I/O Port Assignments for Stand-Alone Operation P4.2 P4.0 VCC P3.2 P3.0 P2.2 P2.0 P1.2 P1.0 VCC P4.3 P4.1 GND P3.3 P3.1 P2.3 P2.1 P1.3 P1.1 GND Connect +5VDC power to this connector RESET Pin: Active high to Reset Connector for transistor when it is used to drive the Speaker connected above Use this resistor to adjust bias current, current limitation, or to correct voice distortion with transistor when the speaker is driven by transistor (typical value - 330Ω) 512K 8M JP2 IMPORTANT! The jumper positions stenciled in the PCB are in error and should be ignored. The correct positions are as illustrated herein Position JP1/JP2 according to the type and size of the EPROM in use (see Section 2.2.2.2 & 2.3.3.2 for details) GSPK (3.58MHz) J8 GND OSC0 VCC POSC OSC1 J4 GND ROSC (Typical : 100KΩ) (Typical Value : 40p) VCC DAOPT 8M Rosc Rb If “POSC” connects to high, the IC clock is generated by crystal. Otherwise, clock is generated by ROSC 1M 4M JP1 Direct Drive Speaker Port If “DAOPT” connects to high, connect speaker to GSPK Port. Otherwise, connect to SPK Port (reference instruction ”TDAOPT”) CE41 CE42 CE43 CE81 EM55000 512K 1M 4M LED RST SPK E C B E Alternate Speaker Port driven by a transistor connected in the connector below EMM55000 Ver. 1.0 (Typical Value : 40p) DIP Socket for EPROM/ROM connection (JP2 stenciled position in error) Figure 2-6 EMM55000 Version 1.0 I/O Port Assignments 26 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 2.3.4.2 EMM55000 Kernel Chip Module Version 2.0 I/O Port Assignment for Stand-Alone Operation P4.2 P4.0 VCC P3.2 P3.0 P2.2 P2.0 P1.2 P1.0 VCC P4.3 P4.1 GND P3.3 P3.1 P2.3 P2.1 P1.3 P1.1 GND Connect +5VDC power to this connector RESET Pin: Active high to Reset Connector for transistor when it is used to drive the Speaker connected above Use this resistor to adjust bias current, current limitation, or to correct voice distortion with transistor when the speaker is driven by transistor (typical value - 330Ω) 512K 8M GSPK JP2 Position JP1/JP2 according to the type and size of the EPROM in use (see Section 2.2.2.2 & 2.3.3.2 for details) GND J4 DAOPT OSC0 J8 GND (Typical Value : 40p) (3.58MHz) VCC POSC ROSC (Typical : 100KΩ) OSC1 VCC 8M Rosc Rb If “POSC” connects to high, the IC clock is generated by crystal. Otherwise, clock is generated by ROSC 1M 4M JP1 Direct Drive Speaker Port If “DAOPT” connects to high, connect speaker to GSPK Port. Otherwise, connect to SPK Port (reference instruction ”TDAOPT”) CE41 CE42 CE43 CE81 EM55000-2 512K 1M 4M LED RST SPK E C B E Alternate Speaker Port driven by a transistor connected in the connector below EMM55000 Ver. 2.0 (Typical Value : 40p) DIP Socket for EPROM/ROM connection Figure 2-7 EMM55000 Version 2.0 I/O Port Assignments EM55000/S/L Series IDE User’s Guide IDE System Installation • 27 Chapter 2 2.3.4.3 EMM55000S Kernel Chip Module Version 1.0 I/O Port Assignment for Stand-Alone Operation P4.2 P4.0 VCC P3.2 P3.0 P2.2 P2.0 P1.2 P1.0 VCC P4.3 P4.1 GND P3.3 P3.1 P2.3 P2.1 P1.3 P1.1 GND Connect +5VDC power to this connector 1M 4M 512K 8M 512K 1M 4M LED RST SPK E C B E RESET Pin: Active high to Reset CE41 CE42 CE43 CE81 EM55000-2 JP2 Position JP1/JP2 according to the type and size of the EPROM in use (see Section 2.2.2.2 & 2.3.3.2 for details) JP1 GSPK 8M Rosc Rb Direct Drive Speaker Port J4 OSC1 J8 OSC0 EMM55000S Ver. 1.0 ROSC (Typical : 220KΩ) DIP Socket for EPROM/ROM connection (Pins without callouts are not used). Typical ROSC is 220KΩ) Figure 2-8 EMM55000S Version 1.0 I/O Port Assignments 28 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 2.4 IDE Program Installation NOTE The IDE Program is available from Elan’s website www.emc.com.tw. Download the IDE Program and execute the setup program (EM55SUDev_V**.exe). The following dialog will then display. Figure 2-9 IDE Program Initial Installation Dialog After clicking the Yes button, installation processes starts and you are prompt to follow the instructions for installation as they appear. After responding to the above dialog, installation will continue until completed. Refer to Chapter 3 for getting started and operation of the program WARNING ! When running the IDE Program under WinNT, you must manually replace the file “MSVCRT.DLL” in the Windows/System directory with the same file located in the bin directory where you have installed the IDE program. 2.5 Starting the IDE Program With the IDE hardware connected to the PC and its external power (+5VDC) switched ON, start IDE Program by clicking on the program icon from desktop or from Windows Start menu. When starting from the Start menu, click Programs, then look for EM55SDev group and click on the icon. Figure 2-10 IDE Program Default Main Window Once the program is started, the program main window displays. Go to the next chapter (Chapter 3) of this manual for the details on the processes of creating projects EM55000/S/L Series IDE User’s Guide IDE System Installation • 29 Chapter 2 2.6 USB Driver Installation for EMK-U You need to install the ELAN provided USB driver included in the IDE package for operating the ELAN EMK-U Emulation Module Kit. After the EMK-U is connected to your computer and the device is switched on for the first time, Windows will detect the new USB device and prompts you to install its driver. Install the driver with the procedure provided below. Note that Windows 2000 is used in the following examples. 1. When Windows shows the “Found New Hardware Wizard” dialog, click Next button. Figure 2-11a “Found New Hardware Wizard” Dialog 1 30 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 2 2. Then the device “ELAN USB EMK” is found and displayed in the next dialog. Accept the default selected method (“Search for a suitable driver for the device”) by clicking Next button. Figure 2-11b “Found New Hardware Wizard” Dialog 2 3. The next dialog prompts you to select the source of the driver. Again accept the default selection (“Specify a location”) by clicking Next button. Figure 2-11c “Found New Hardware Wizard” Dialog 3 EM55000/S/L Series IDE User’s Guide IDE System Installation • 31 Chapter 2 4. The next dialog will require you to specify or browse for the location of the driver. Browse from the directory where your IDE is located; look for the folder EM55SUDev V2.9\USBData. Then click Browse button to auto-locate the EMK USB driver. C:\Program Files\ELAN\ EM55SUDev V2.9\USBData Figure 2-11d “Found New Hardware Wizard” Dialog 4 5. From the Locate File dialog that follows, the driver with filename elan_emk.inf, is automatically displayed. Click Open button to continue. elan_emk elan emk inf Figure 2-11e “Locate File” Dialog 6. Hardware Wizard then confirms the location of the driver. Click Next button again to start the installation process. 32 • IDE System Installation EM55000/S/L Series IDE User’s Guide Chapter 3 Chapter 3 Getting Started with IDE Program 3.1 Overview This chapter provides a step-by-step description on How to create a new program project How to add/remove existing source files in a project. How to edit, assemble, and build the projects. How to generate Binary and Mask Files from project How to debug the project when errors occur. New Project Select Series/Body Project Name Select EASY/ASM Option Yes EASY ? Select EASY Option No Add ASM Files Add EASY File Add Voice/Melody Data Files Figure 3-1 IDE Program Project Building Flow Chart EM55000/S/L Series IDE User’s Guide Getting Started with IDE Program • 33 3 Chapter 3 3.2 IDE Environment Source Files Format The IDE Program requires that your source files conform to the following formats: File Type Required Filename Extension Description Assembly Program USERNAME.ASM Assembly program to control EM55000 series chips. EASY Format Program USERNAME.ESY EASY format program to control EM55000 series chips. USERNAME.TBL Text type table section** file USERNAME.TLY Binary type table section** file that can be used without translation. USERNAME.XXX* PCM or Elan’s VDS format speech section** file. Table File Section/Speech File * Filenames for speech files may end with any extensions except “BIN” or “LAY.” Speech files, including “RAW DATA” format, “WAV” format, or Elan’s SCS (VDS) format are supported. IDE Program will be able to auto-detect speech files under these formats. ** The smallest playback unit for EM55000 series is called a "Section." Each Section can either be a Table File or a Speech File. 3.3 Create a New Program Project for Coding 1. To create a new program project, you may open the new project dialog with one of the following: Click on File menu and choose New command from the resulting Pull-down menu. Click the New button from the Tool Bar. Right click on the root node (on top of the Project View window) and choose New Project. Figure 3-2a “File” Menu 34 • Getting Started with IDE Program EM55000/S/L Series IDE User’s Guide Chapter 3 2. When the New dialog displays, click on Project tab to display the following dialog. 4 3 2 PROM/ROM/RA M information of the selected body 5 6 7 8 Figure 3-2b “New” Dialog Showing Project Tab for Configuring the New Project 3. Select the type (Asm or EASY) of the new project you are creating from the Type option box. Further setup is required (see next section) if EASY is selected. . Define the series and the target chip body for the new project from the Series and Body list boxes respectively (defaults are EM55 and EM55001 respectively). NOTE The PROM/ROM/RAM size information of the selected body will be shown in the INFO box. 5. Assign a name for the new project in the Name text box. Suffix .prj will auto-append to the project name. 6. Type the folder where you want to store the new project in the Location text box or use the Browse button to find the appropriate folder. NOTE The “Location” directory of the new project is the working directory. If the source files you are going to add into the new project are in the same directory, the project will record its filenames only. If they are located elsewhere other than the working directory, the project record their full pathnames. During compiling, project will process the files under the working directory as local files. Otherwise, it will search through the directories for the files with absolute pathname. EM55000/S/L Series IDE User’s Guide Getting Started with IDE Program • 35 3 Chapter 3 7. Assign clock type (Ring or Crystal) to be used in the OSC option box. NOTE Clock is fixed to “Ring” for EM55001/L, EM55002/L, EM55100/L, and EM55003S.” 8. Click OK button when done. The Project Setting Summary window will then appear to announce the successful creation of the new project and displays its properties. 9. Click the OK button at the bottom the window to return to main IDE window. Observe the Workspace window displays the new project related files and its properties. Note that the displayed files are all empty. You need to fill in the files with your source files as described in Section 3.4. Figure 3-2c “Project Setting Summary” Window Figure 3-2d “Workspace” Window for ASM Type Empty Project 3.3.1 Further Setup for “EASY” Type Project 3 For an “EASY” type new project, The Easy Setting…dialog will appear to prompt you for further setup on EASY 1 properties. 2 4 5, 6, 7 8 9 Figure 3-3a “Easy Setting” Dialog for New Project 36 • Getting Started with IDE Program EM55000/S/L Series IDE User’s Guide Chapter 3 The Key Type group box sets the EASY key configuration. IDE Program provides several default scankey types. If you want to use your own keyboard scan routine or use more keys than what IDE provides, do the following: 1. Click on Custom check box to enable the function, then enter the keyboard scan routine filename in the File text box or use the Browse button to find the appropriate file. 2. Enter the number of the custom keyboard keys in the KeyNumber text box. 3. Then set the pertinent port configuration in the corresponding port text boxes (P2, P3, P4). This is to prevent the keyboard scan routine from being influenced by output pattern. The value in each Output Config text box is a 4-bit binary value, which corresponds to the pins of their respective ports. The value “1” means the corresponding pin can be used for output. “0” means the corresponding pin is used for keyboard scan and cannot be used as output. Example: P2:1100 means P2.3 and P2.2 can be used as output, but NOT P2.1 and P2.0. 4. If you are gong to use your own IR routine, check the Custom IR check box and enter the IR Transmit routine filename in the TX: text box and the IR Receive routine filename in the RX: text box. You may use the Browse button to find the appropriate filenames. More on IR applications are described in Appendix C. 5. Select the appropriate debounce time in the Debounce spin box. The value N can be 1 to 8 and the debounce time will set to N*6.8 ms. 6. Then enable NO_STOP check box if you want to allow the chip to continue playing when a trigger is received. 7. Also check the Hi-Res Timer check box if you are going to use High Resolution Timer (1ms). 8. Define random number generator in the Random Option group box. Each random register value N can be set to the range of 2-16, and the random number will be in the range of 0 to N-1. EM55000/S/L Series IDE User’s Guide Getting Started with IDE Program • 37 3 Chapter 3 9. Click OK button when done. The Project Setting Summary window will then appear to announce the successful completion of the newly created project and displays its properties. 10. Click the OK button at the bottom the window to return to main IDE window. Observe the Project View window displays the new project related files and its properties. Note that the displayed files are all empty. You need to fill in the files with your source files as described in the following section (Section 3.4) Figure 3-3b “Project Setting Summary” Window Figure 3-3c “Workspace” Window for EASY Type Empty Project 3.4 Adding Source Files into Project You can either insert existing source files into the new or existing project, or create new ones from within IDE Program Editor window and automatically insert them into the project. The 3 methods in which source files can be added into the project are explained in the following sections. 3.4.1 Edit and Add a New File from IDE Program Editor If your program (.asm, .esy) or table (.tbl, .tly) source files are yet to be created, you can take advantage of the File dialog to configure your new source file and use the IDE editor to compose its content. The created file can be set to automatically add into the project when completed. To do this1. Click on File menu and choose New command from the resulting Pull-down menu. When the New dialog appears, click on File tab. Figure 3-4a “File” Menu 38 • Getting Started with IDE Program EM55000/S/L Series IDE User’s Guide Chapter 3 1 5 2 3 4 6 Figure 3-4b “New” Dialog Showing File Tab for Creating a New Source File 2. Select to define the file type (EASY/Assembly, Table, etc.) for your new source file in the File Type group box. 3. Assign filename for the new file in the File Name text box. Note that IDE Program will auto-suffix filename with extension in accordance with the file type selected in the File Type group box. 4. Enter the folder where you want to store the new file in the Location text box. You may use the Browse button to locate the folder. 5. Remember to enable the Add into Project check box if you want to automatically insert the content of the new file into the project when editing is completed. NOTE The new files added into project through this method must be editable, that is, they should be of EASY, Assembly, or Table file type only. Hence, speech files cannot be added using this method as they are not editable. Use other methods described below. 6. Click OK button to apply settings and start editing the new file. 3.4.2 Add Existing File through “Add into project” Command Click on the Project menu from Menu bar and choose Add into project… command. The Open dialog (see next page) will appear to prompt you to browse for the existing program or speech source file you wan to add. Browse for the file as you would do under standard Windows procedure. Figure 3-5 “Project” Menu EM55000/S/L Series IDE User’s Guide Getting Started with IDE Program • 39 3 Chapter 3 3.4.3 Add Existing File from the Project View Window You can also insert your ready-made program or speech source files through the project tree in the Project View window. 3.4.3.1 Adding Existing Program File \ To add existing program (.asm, .esy) files, right click on the Source Files node. Then click on the Add files… pop-up menu that appears. The Open dialog will then display to prompt you to select for the file from the list of program files. Figure 3-6 “Project View” Window Showing a Right Clicked “Source File” Node Figure 3-7 “Open” Dialog Box 3.4.3.2 Adding Existing Speech File To add speech (.wav, .raw, etc.) files, right click on the Section File node, and then click on the Add files… pop-up menu that appears. The Open dialog (see figure on top) will then Figure 3-8a display to prompt you to select for the file from the list of speech files. “Project View” Window Showing a Right Clicked “Section File” Node Speech File Property Setup When adding speech file, you need to specify the coding method and set marks to your file before inserting it into the project. Right click on the speech file and choose Property from the resulting menu. The Property dialog will then display (see next page). NOTE The valid length of the Mark code should not exceed 2048 characters, including spaces and commas (,). The set marks or points, must be listed in increasing order, e.g., 100, 200, 300, 400, etc. 40 • Getting Started with IDE Program Figure 3-8b “Project View” Window Showing a Right Clicked Speech File EM55000/S/L Series IDE User’s Guide Chapter 3 Take note that double clicking on the speech file will directly display the Property dialog. Figure 3-8c Speech File “Property” Dialog 3.5 Modifying Project Settings If you want to change the project settings, such as target chip body, EASY key type configuration, etc., before project building, perform such changes through the project Option Setting… command. To access the command, you can do one of the following: Right click on the project filename (on root Figure 3-9a node of the Project View window). Then from the resulting menu, click on the Option Setting command. From the Menu bar, click Project. Then from the resulting menu, click on the Option Setting… command “Project View” Window Showing a Right Clicked Project Filename The following dialog will then display. Figure 3-9b “Project” Menu Figure 3-9c Project “Option Setting” Dialog EM55000/S/L Series IDE User’s Guide Getting Started with IDE Program • 41 3 Chapter 3 3.6 Building Project With all the coding details are done, you are now ready to compile your inserted files to generate binary file (.bin) for your application using the Build or Rebuild All command. To access the command, you can do one of the following: From the Menu bar, click Project. Then from the resulting menu, click on the Build or Rebuild All command as required. Press F7 for Build or F8 for Rebuild All. Figure 3-10a From the Tool bar, click on the Build icon or Rebuild All icon as needed. “Project” Menu Use Build command if you want to compile and debug your source file at the same with IDE Editor. Compilation under Build command is carried out using the last revised version of the file as it appears in the Editor window, keeping the original file in your disc unchanged. You can always go back to the original file if unsatisfied with the result of the current compilation. Choose Rebuild All command (same with Save All command from File menu) when you want to compile and code all files in the project after all the recently modified files are saved. After compiling, the Custom Number dialog box will display to prompt for a custom number and an applied voltage for generating an Approval form and Mask file for chips ordering purposes. Figure 3-10b “Custom Number” Dialog NOTE The Custom Number cannot be the default value “000” and at least one of the Applied Voltage options must be enabled (checked). 42 • Getting Started with IDE Program EM55000/S/L Series IDE User’s Guide Chapter 3 All error messages generated during compilation are displayed in the IDE Message window. You can double click on the error message and the IDE will show you the actual line at fault in the Editor window for your correction. If the building process detects no error, the generated binary file (.bin) will automatically download into IDE Emulation Board for testing and evaluation. IDE will check whether the Emulation Board is connected to your PC before downloading. Double click on the particular error to link and locate the corresponding line in error in the Editor window. Figure 3-10 IDE Coding Program Output Message Window 3.7 Editing the Project Inserted Source File Source files that are already inserted into the Project, maybe opened in the IDE Editor window for review and modification. To do this, point and double click on the file you want to open from the Project View window and the file will immediately open in the Editor window. Refer to Section 1.2.1.4 (Edit menu) and Section 1.2.1.5 (Toolbar) for the description of the available editing tools to help you with your editing. EM55000/S/L Series IDE User’s Guide Double click to edit file Figure 3-11 “Project View” Window Showing a Double Clicked Source File Getting Started with IDE Program • 43 3 Chapter 3 44 • Getting Started with IDE Program EM55000/S/L Series IDE User’s Guide Chapter 4 Chapter 4 Processing ASM Programs for EM55000/L Series 4.1 Writing an Assembly (ASM) Program 4.1.1 File Format The following is an example of an Assembly file format for EM55000/L series. INCLUDE “define.inc” pageA EQU page7 temp EQU m0 DEFINE SETKEY SetP3 MACRO P3Value, P3SValue mov a, P3Value mov P3, a mov a, P3SValue mov P3S, a ENDM PowerOn: IFDEF SETKEY keyb ELSE nop ENDIF SetP3 #0000b, #1111b jmp main ;set Port3 ;jump to main routine Init: PageA mov a, temp mov P3, a … … main: … … mov rate2, 8k play2 song1.wav … … EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series • 45 3 Chapter 4 4.1.1.1 File Structure The Assembly project supports multiple-files features, whereby, a program can be separated into several numbers of files. All labels defined for each file within the same project must be unique and contain the power conservation signal labels POWERON and INIT. POWERON is where the program operation starts after power (i.e., battery) is switched on. INIT is the starting point where program operation starts or wakes-up after a power-down or sleep mode period. NOTE • For EM55001/L and EM55002/L, “wake-up” is initiated whenever a rising/falling edge pulse is provided to Port 2 during sleep mode or power-down period. • For EM55200/L ~ EM55700/L, “wake-up” is initiated whenever a rising/falling edge pulse occurs at Port 1 or Port 2 without invoking the KEYB instruction. With the KEYB instruction is invoked, “wake-up” is initiated only when a rising/falling edge pulse occurs at Port 1 of EM55200/L ~ EM55700/L. 4.1.1.2 Statement Line An assembly program is written in statement lines. A statement line has the following format: [Label:] Mnemonic [Operand1 [,Operand2…] ] [;Comment] Where: Label: Label definition must be followed by a colon (:). Mnemonic: Including OpCode and Macro name. Operands: Memory notation or constant value. Comment: Starts with a semi-colon (;), all words after the semi-colon (;) are ignored by assembler. All words are case-insensitive eithin the program. 4.1.1.3 Section Definition All the voice and table (TBL/TLY) files required for your application are defined in the project. The processes of adding section files and setting up section properties are defined in Section 3.4.3.2 in Chapter 3. 46 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 4 4.1.2 Control Register The following are the control registers in EM55000/L series chips: STATUS DFLAGG 3 CFLAG FMODE 1 1 TMODE 2 2 Figure 4-1 EM55000/L Series Control Registers 4.1.2.1 STATUS (Play Flag, Timer Overflow Flag, and Carry Flag) Bit Name Reset 0 Wake-up Description Unused 1 Ch2flag 0 2 Timerflag 0 3 Carryflag 0 1: ch2 is playing 0: ch2 is not playing 1: timer is overflowing 0 0: timer is not overflowing 1: overflow when under addition Unchanged 0: underflow when under subtraction 0 STOP2: Stop ch2’s playing, reset Ch2flag and keep the final value of ch2 in D/A. RSTTF: Reset Timerflag. (NOTE: This does not reset timer. It is different from EM58000 series) RSTCF: Reset Carryflag. 4.1.2.2 DFLAG (Data Flag For Accessing Marked Samples and New Notes) Bit Name Reset Wake-up 0 1 Description Unused Mark2 0 0 1: ch2 has accessed the marked sample 0: ch2 has not accessed the marked sample 2 3 RSTM2: Reset Mark2 (NOTE: Flags in DFLAG register (Mark2) can not be reset automatically. It must be reset by RSTM2). 4.1.2.3 CFLAG (Control Flag for Mute) Bit Name Reset Wake-up Ch2mute 0 Unchanged Description 0 1 1: ch2 mute enable 0: ch2 mute disable 2 3 NOTE: The sample rate of ch2 is affected by register RATE. EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series • 47 3 Chapter 4 4.1.2.4 FMODE (Flash and IR Mode) Bit Name Reset Wake-up 0 1 Description Unused Voice2f 0 Unchanged 2 1: voice flash of ch2 enabled 0: voice flash of ch2 disabled Unused 3 IRf 0 Unchanged 1: 38 KHz signal enabled while P32 is in output state 0: 38 KHz signal disabled while P32 is in output state P33 : If Voice2f = 0, P33 will be treated as a general purpose I/O pin. Otherwise, P33 will be treated as an LED output that flashes with volume subject to Voice2f status. The flash LED must be connected between Vcc and P33 in sinking pattern. P32 : When P32 is in output state, it will output its content if IRf= 0. Otherwise, P32 will output 38KHz square wave. When P32 is in tri-state, IRf will not affect P32. NOTE : If you use P33 as an LED output by setting Voice2f to “1,” it is recommended that you change Voice2f status to “0” every time the chip switches to power-down (sleep) mode. More energy can be saved this way when chip is in sleep mode. 4.1.2.5 TMODE (Table-Read Mode) Reset Wake-up Bit 1 Bit 0 0 0 Unchanged Unchanged 0 0 0 1 1 0 1 1 Description Normal mode Table-read mode The instruction “PLAY2 sec” will play the voice file, named “sec” in normal mode. It will set the content of the data Pointer 2 (DP2) as the initial address of the table file named “sec” in the table-read mode while playing for ch2 is disabled. 48 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 4 4.1.3 I/O Registers P1 P2 4/0 4/2 P2S P4 P3 4 4 4/2 P3S P4S 4 4 Figure 4-2 EM55000/L Series I/O Registers NOTE 1. P1 is not available for EM55001/L and EM55002/L. 2. P2 and P2S have only 2 bits for EM55001/L (P2.0 , P2.1). 3. P4 is available only for EM55450/L to EM55700/L. 4.1.3.1 P2, P3, and P4 (P2, P3, and P4 Registers) Name Reset Wake-up P2 0000b No Change P3 0000b No Change P4 0000b No Change 4.1.3.2 P2S, P3S, and P4S (P2, P3, and P4 Status Registers) Name Reset Wake-up Description P2S 1111b 1: the corresponding bit is of tri-state No Change 0: the corresponding bit is “1” or “0” in consistent with the content of register P2 P3S 1111b 1: the corresponding bit is of tri-state No Change 0: the corresponding bit is “1” or “0” in consistent with the content of register P3 P4S 1111b 1: the corresponding bit is of tri-state No Change 0: the corresponding bit is “1” or “0” in consistent with the content of register P4 NOTE To conserve more energy during power-down (Sleep) mode, P2S P3S, or P4S pins must NOT be floating when their corresponding bit is set to “1.” EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series • 49 3 Chapter 4 4.1.4 Assembler Directives The Assembler provides several directives as summarized below. DEFINE / UNDEF : Define/Undefine a Symbol DEFINE <sym1> UNDEF <sym2> Define/undefine a symbol to make the symbol available for IFDEF directive under different assembly conditions. EQU : Replace Value/String with a Specified Symbol Name <label> EQU <constant> <label> EQU <string> Replace a value or string with a specified symbol name. Programmer may use established symbol names to make the program more readable. Example: A1 EQU #08h A2 EQU M1 IFDEF, ELSEIFDEF, ELSE, ENDIF : Conditional Assembly IFDEV <sym1> < statements for sym1 defined > [ELSEIFDEF sym2 < statements for sym2 defined >] [ELSE < statements for sym2 and sym2 not defined >] ENDIF (related : IFNDEF, IF) The assembler only assembles the block where the symbol is defined after the directive. Nested condition is not supported, that is, do not use another IF condition in an IF block. 50 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 4 INCLUDE : Include Files INCLUDE “filename” Use to include files containing symbol definition, macro, or procedure definition, etc. An include file can include other “Include file,” but the maximum include depth should not exceed 8 levels. Assembler will initially searches the file in the path where the source file is located. If not found, it will search from the directory where the IDE Program is located. Please do not include files that are already added in the project. Macro / ENDM: Macro Definition <label> MACRO [<param1>,…,<paramn>] <statements> ENDM Macro must be defined before use. Calling other macro in a macro definition is allowed but it is not valid to define a new macro within a macro definition block or calling the macro itself (recursive). The max level of macro call is 8. Local labels in a macro must start with ‘$’ and should be followed by a 3-digit sequence number after expansion Example 1: MAC1 MACRO XXX $LOCAL: XXX ENDM ($LOCAL will be $LOCAL001 in the first macro expansion and $LOCAL002 in the second.) Example 2: Definition Mac1 Macro Para1, Para2 mov a, Para1 mov p2s, a mov a, Para2 mov p2, a EndM Usage Expansion SetPort: SetPort: … Mac1 #0000b, #1111b … … mov mov mov mov a, #0000b p2s, a a, #1111b p2, a … EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series • 51 3 Chapter 4 4.1.5 Assembly Program Instruction Set NOTE In the following instructions, the data value can be 0 ~ 15 or 0000b ~ 1111b, and the M? value can be M0 ~ M15 Symbol Description Remarks Play the voice file named “sec” at ch2 in normal mode. Set the content of the Data Pointer 2 (DP2) as the initial address of the table file named “sec” in table-read mode PLAY2 sec PAUSE2 *1 Pause/unpause ch2’s playing MOV VOL22, #data *2 Transfer immediate data to VOL22 register (ch2 to VO2) MOV VOL22,A *2 MOV RATE2, #data *3 Transfer immediate data to RATE2 register MOV TIMER, #data *4 Transfer immediate data to TIMER register Transfer data from A register to VOL22 register (ch2 to VO2) The sample rate will be affected by register RATE2 --The content of Register A will be modified --The content of Register A will be modified The content of Register A will be modified MOV A, STATUS Transfer data from STATUS register to Register A --- STOP2 Stop ch2’s playing, reset Ch2flag, and keep the final value of ch2 in D/A --- RSTTF Reset Timerflag (This does not reset timer counter. This differs with EM58000 series) --- RSTCF Reset Carryflag --- MOV A, DFLAG Transfer data from DFLAG register to Register A --- RSTM2 Reset Mark2 flag --- MOV CFLAG, A Transfer data from Register A to CFLAG register --- MOV FMODE, A Transfer data from Register A to FMODE register --- MOV TMODE, A Transfer data from Register A to TMODE register INCDP2 Increment the content of the data pointer 2 (DP2) by 1 in table-read mode TMODE is a 2-bit register --- MOV A, DATAL Transfer the low nibble data pointed by DP2 in ROM to Register A in table-read mode --- MOV A, DATAM Transfer the middle nibble data pointed by DP2 in ROM to Register A in table-read mode --- 52 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 4 MOV A, DATAH Transfer the high nibble data pointed by DP2 in ROM to Register A in table-read mode The MS 2 bits in Register A will be 0’s MOV A, P1 Transfer data from Port1 to Register A For EM55100/L~EM55700/L only MOV A, P2 Transfer data from Port 2 to Register A The MS 2 bits in Register A will be “0” for EM55001/L MOV A, P3 Transfer data from Port 3 to Register A The LS 2 bits in Register A will be “0” for EM55001/L MOV P2S, A Transfer data from Register A to status register of Port 2 The MS 2 bits in Register A must be set “0” for EM55001/L MOV P3S, A Transfer data from Register A to status register of Port 3 The LS 2 bits in Register A must be set to “0” for EM55001/L MOV P4S, A Transfer data from Register A to status register of Port 4 For EM55450/L~EM55700/L only MOV P2, A Transfer data from Register A to Port 2 The MS 2 bits in Register A must be set to “0” for EM55001/L MOV P3, A Transfer data from Register A to Port 3 The LS 2 bits in Register A must be set to “0” for EM55001/L MOV P4, A Transfer data from Register A to Port 4 For EM55450/L ~ EM55700/L only MOV A, #data Transfer immediate data to Register A --- MOV A, M? Transfer data from memory to Register A --- MOV M?, #data Transfer immediate data to memory --- MOV M?, A Transfer data from Register A to memory --- AND A, M? (A) and (M?) ---> (A) --- OR A, M? (A) or (M?) ---> (A) --- XOR A, M? (A) xor (M?) ---> (A) --- ADD A, M? (A) + (M?) ---> (A) ADD A, #data (A) + immediate data ---> (A) SUB A, M? (A) - (M?) ---> (A) SUB A, #data (A) – immediate data ---> (A) --- RLCA Rotate left Register A with Carryflag --- RRCA Rotate right Register A with Carryflag --- JMP label Change program location to “label” --- CAJE #data, label If (A) = immediate data, then change program location to “label” --- CAJE M?, label If (A) = (M?), then change program location to “label” --- CALL label Call subroutine RET Return from subroutine --- PAGE0 Select first page memory --- PAGE1 Select second page memory --- PAGE2 Select third page memory PAGE3 Select fourth first page memory EM55000/S/L Series IDE User’s Guide If overflow occurs, Carryflag is set --If underflow occurs, Carryflag will reset There are two levels of subroutine call For EM55100/L ~ EM55700/L only Processing ASM Programs for EM55000/L Series • 53 3 Chapter 4 PAGE4 Select fifth first page memory PAGE5 Select sixth first page memory PAGE6 Select seventh page memory PAGE7 Select eight page memory KEYB Change input pull low impedance of P2 from 1M to 10K (approximate), and disable wake-up function of P2 --- STOPDA Stop ch2’s playing, reset Ch2flag, and turn off D/A --- END Enter power-down mode --- Enable interpolation function of output voice (this is a default setting for output voice) --- Disable interpolation function of output voice --- INTER NOINTER *5 TDAOPT For EM55200/L ~ EM55700/L only This instruction allows the next “jmp” instruction to execute in accordance with the type of speaker connector (direct drive or transistor driven) in used *6 NOP NOTES: For EM55200/L ~ EM55700/L only For EM55200/L ~ EM55700/L only No operation --- *1 If the audio file is in Pause mode, the play flag (Ch2flag) will remain at “1.” A new Play instruction will end the previous audio file Pause status and play the new audio file. *2 The range of volume is from 0 to 15 where 0 is the minimum and 15 is the maximum volume. If you set the volume to 0, the speaker will be off (mute). *3 “MOV RATE2, #data” is used to determine the sample rate of the voice playing at ch2. The available voice sample rates are as follows: 1174 1183 1193 1202 1212 1222 1232 1243 1253 1264 1274 1286 1297 1308 1320 1332 1344 1356 1368 1381 1394 1407 1420 1434 1448 1462 1476 1491 1506 1522 1538 1553 1570 1586 1603 1621 1639 1657 1676 1695 1715 1734 1754 1775 1797 1819 1841 1864 1888 1912 1937 1962 1988 2016 2043 2071 2100 2130 2161 2193 2226 2260 2294 2330 2367 2405 2445 2486 2528 2571 2616 2663 2712 2814 2868 2925 2983 3044 3107 3173 3242 3315 3390 3468 3551 3638 3729 3825 3925 4031 4143 4261 4387 4520 4661 4811 4972 5143 5327 5525 5737 5966 6215 6485 6780 7103 7458 7850 8287 8774 9322 9944 10654 11474 12430 13560 14916 16574 18645 21310 #Data can be 2K, 3K,…21K to represent 2K, 3K,…21KHz playing speed respectively. Furthermore, #Data can be a real integer between #1174 and #21310 to represent playing speed (Hz). The IDE tool will look for the value that is the nearest to the above mentioned sample rates in executing the play command. 54 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 4 *4 “MOV TIMER, #data” is used to determine the speed of the internal timer. The value of data can be one of the following: Data Overflow time 0 1 2 3 0.85 ms 1.7 ms 3.4 ms 6.8 ms *5 ”INTER”/”NOINTER”: Enable or disable interpolation function of output voice. Output voice signal is 7-bit to 8-bit resolution when using interpolation. Default setting for “Play2” instruction is interpolation-enabled function (INTER). Interpolation flag is disabled when “NOINTER” is executed. *6 A rising waveform is usually added at beginning of a playing voice when the speaker is driven by transistor, but not for direct driven speaker. If you inadvertently add a rising waveform at the beginning of a playing voice with a direct drive type speaker, it will generate a noise. Thus, an instruction “TDAOPT” is provided to let you execute different programs to control the use of raising waveform in playing in accordance with the connected speaker type. With Elan real chip body: When the chip power is on, the chip will auto-detect the type of connected speaker, and save this status in an inner register (s0). If the speaker connects to VO1 and VO (i.e., direct driven), s0 is set to 1. If speaker is driven by a transistor (i.e., connected to VO only), s0 is cleared to 0. With kernel chip: The status of pin “DAOPT” is stored at “s0.” When executing instruction “TDAOPT,” “s0” will determine whether to or not to execute the next “jmp” instruction. If s0 = 0 "jmp" instruction will be executed. If s0 = 1 the next "jmp" instruction is skipped and execution will continue to with the succeeding instruction. Refer to the following example. 4.1.5.1 Example . call @play_raising_waveform mov rate2,#8000 ;//Modify this value play2 voice.wav call @play_falling_waveform . @play_raising_waveform: ;//{ TDAOPT Jmp @play_raising_waveform_1 ret @play_raising_waveform_1: Mov rate2,#4000 ;//Modify this value Play2 raising.wav Mov m0,#0010b EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series • 55 3 Chapter 4 @check_raising_play_finish: Mov a,status ;//Check ch2 play completed or not And a,m0 Caje m0, @check_raising_play_finish ret ;//} @play_falling_waveform: ;//{ TDAOPT Jmp @play_falling_waveform_1 ret @play_falling_waveform_1: mov rate2,#4000 ;//Modify this value Play2 falling.wav Mov m0,#0010b @check_falling_play_finish: Mov a,status ;//check ch2 play finished or not And a,m0 Caje m0,@check_falling_play_finish ret ;//} If s0= =0: (ie. In real chip : Speaker is driven by a transistor in kernel chip : DAOPT pin connect to GND) in @play_raising_waveform routine, raising.wav will be played in @play_falling_waveform routine, falling.wav will be played If s0= =1: (ie. In real chip : Speaker is connected to VO1,VO in kernel chip : DAOPT pin connect to VDD) in @play_raising_waveform routine, raising.wav will be skipped in @play_falling_waveform routine, falling.wav will be skipped 56 • Processing ASM Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Chapter 5 Processing ESY Programs for EM55000/L Series 5.1 Writing an EASY Format® (ESY) Program 5.1.1 File Format [InputState] … … [OutputState] … … [Path] Path0: … … [Background] … … [Asm] … [TimerAsm] … The EASY program does not support multifile. An EASY format source file consisted of several blocks, i.e., InputState, OutputState, Path, Asm, and Background. The blocks can be written in different order and all words are case-insensitive. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 57 3 Chapter 5 5.1.1.1 [InputState]: StateName : PathName1, PathName2, …, PathNameN InputState is defined for each input trigger state assignment. You can define up to 256 states with different input state names. The state name must be followed, by the ‘N’ trigger of selection options, where N is the option selected in the project for EASY-N setting. The trigger selection options can be one of the following: when the corresponding trigger is invoked (or pressed in case of keypad), the path equation with path name “p_name” is executed. /p_name when the corresponding trigger is released, the path equation with path name “p_name” is executed. p_name1/p_name2 when the corresponding trigger is invoked (or pressed in case of keypad), the path equation with path name “p_name1” is executed. When the corresponding trigger is released, the path equation with path name “p_name2” is executed. X disable the corresponding trigger (no action). P_name 5.1.1.2 [OutputState]: OutputName : P2=[O3 O2 O1 O0], P3=[O3 O2 O1 O0], P4=[O3 O2 O1 O0] OutputState is the set output state of the available port. Note that P2 cannot be set with EM55001/L and EM55002/L; and P4 can be set for EM55450/L ~ EM55700/L. Moreover, the usage of ports will depend on the type of trigger selected under EASY-N or DIRECT-N. “O3, O2, O1, and O0” stand for Pn.3, Pn.2, Pn.1, and Pn.0 respectively. Each pin may be defined as follows: 1 0 P+ P– S+ S– F X set the corresponding I/O pin as “H” set the corresponding I/O pin as “L” send a pulse train beginning from “H” to the corresponding I/O pin send a pulse train beginning from “L” to the corresponding I/O pin send a positive pulse to the corresponding I/O pin send a negative pulse to the corresponding I/O pin set the designated I/O pins as tri-state keep unchanged the current state of the corresponding output pin or used as “not used” pin PWM set the corresponding I/O pin as PWM output. The duty cycle is selected by PWM(n) parameter and the period is 17ms. (20*0.85ms) Output Port Configuration for EASY-N EM55001/L EASY-2 EASY-4 EASY-6 P3=[O, O, X, X] P3=[O, X, X, X] N/A 58 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 EM55002/L EASY-4 EASY-8 EASY-12 EASY-16 EASY-20 P3=[O,O,O,O] P3=[O,O,O,X] P3=[O,O,X,X] P3=[O,X,X,X] N/A EM55100/L ~ P2=[O,O,O,O] P2=[O,O,O,X] P2=[O,O,X,X] P2=[O,X,X,X] EM55551/L P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P2=[O,O,O,O] P2=[O,O,O,X] P2=[O,O,X,X] P2=[O,X,X,X] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] EM55450/L ~ EM55700/L P3=[O,O,O,O] P3=[O,O,O,O] P4=[O,O,O,O] Where: O: can be used as output pin; X: can not be used as output pin; N/A: No output is available Output Port Configuration for DIRECT-N DIRECT-5 DIRECT-6 DIRECT-7 DIRECT-8 EM55100/L ~ P2=[O,O,O,X] P2=[O,O,X,X] P2=[O,X,X,X] P2=[X,X,X,X] EM55551/L P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P2=[O,O,O,X] P2=[O,O,X,X] P2=[O,X,X,X] P2=[X,X,X,X] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P3=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] P4=[O,O,O,O] EM55450/L ~ EM55700/L Where: O: can be used as output pin; X: can not be used as output pin; N/A: No output is available 5.1.1.3 [Asm]: In-EASY Assembly [ASM] AsmName1_BEGIN: <statements> label: <statements> AsmName1_END M AsmName2_BEGIN: <statements> AsmName2_END In-EASY assembly provides a block for you to write assembly code in EASY format. The syntax of In-EASY assembly is the same as the assembly language described in Chapter 4, but without assembly directives. In-EASY assembly can use local label in its definition block. The In-EASY assembly definition starts from a name designation of “_Begin” and end with “_End”. The name is used in Path or Background section to execute the assembly block. The following instructions should not be used in the In-EASY assembly to avoid influencing the EASY internal routine: EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 59 3 Chapter 5 “play2 section”, “mov timer, a”, “call”, “ret” “end”. 5.1.1.4 [TimerAsm]: TimerAsm block provides an entry point for user-defined routine to be automatically executed at every timer overflow. This is a special arrangement within the In-EASY assembly whereby you need not bother to take any action at every timer overflow. With the “Hi-Res Timer” setting, this piece of codes is executed at every 1ms, which is almost 8 times more than normal routine. A piece of assembly code is written in this block. Unlike the format used under In-EASY assembly block, “XXX_Begin” and “XXX_End” are not required for the TimerAsm block definition. 5.1.1.5 [Path]: PathName : parameter0, parameter1,…,parameterN You can define as many path equations as needed and assign each with different path names, i.e., p_name1, p_name2, etc. The path name “path0” must exist in an EASY program as the start of the program. Each path equation line should contain less than 255 characters. If a line is inadequate to define a path equation, additional lines may be added. But the additional lines must begin with an ampersand (&) to indicate it is a continuation to previous line of the same path equation definition. Each path equation definition may contain one or more of the following parameters as may be required: InputState Name activate the input state as defined in [InputState] section OutputState Name set output port as the name to be defined in [OutputState] section Path Name jump to the other path as defined in the [Path] section Asm Name call the In-EASY assembly block defined in [Asm] block CH2:Section name play the voice file in Channel 2. It will call the scan loop and execute the next parameter till the playing stops [CH2:Section name] play the voice file in Channel 2 without calling the scan loop nor executing the next parameter immediately 60 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 CH2:Section name x N play the voice file in Channel 2 and repeat N times [CH2:Section name] x N play the voice file that is repeated N times in Channel 2 without calling the scan loop CH2:FREQ=data define the playing speed of the voice file in Channel2. “Data” could be either “1K”, “2K”, … ”22K” to represent 1KHz, 2KHz, … 22KHz playing speed respectively. Furthermore, it could be a real integer number between1174 and 21310 to represent playing speed (Hz) VOL22=data/mi set the audio playing volume in 16-steps increment from Channel 2 to VO2. “data” is any value from 0 to 15. 0 is the lowest and 15 is the highest DP2:Section Name set the contents of the data Pointer 2 (DP2) as the initial address of the table file for table-read DP2=DP2+data increment the contents of the data Pointer 2 (DP2) by data for table-read NOTE The CH2:Section name parameters will also change contents of the data Pointer 2. Hence, do NOT insert any of the CH2:Section name parameters between DP2 and DP2=DP2+data or Mi=DATAL/M/H. Otherwise, wrong data will result. DELAY(n) delay “n” seconds. Minimum delay unit is 0.008 seconds. Example, Delay(0.2) means 0.2 second delay and Delay(8.6) means 8.6 seconds delay RATE=n define the flash rate of flash output pins that are set to “P+” or “P–“. N can be any number from 1 to 8 of the eight flash rate variables 16/n Hz. RandN?=data/Mj:p_name if the contents of register RandN equals to data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 RandN?<>data/Mj:p_name if the contents of register RandN does not equal to data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 RandN?!=data/Mj:p_name if the contents of register RandN does not equal to data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 61 3 Chapter 5 RandN?>data/Mj:p_name if the contents of register RandN is greater than data/register “Mj” contents, the path equation with the path name “p_name” will be executed. can be any number from 1 to 3 RandN?<data/Mj:p_name if the contents of register RandN is less than data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 RandN?>=data/Mj:p_name if the contents of register RandN is greater than or equals to data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 RandN?<=data/Mj:p_name if the contents of register RandN is less than or equals to data/the contents of register “Mj”, the path equation with the path name “p_name” will be executed. N can be 1 to 3 RandN:[p_0 x p_2 …] if the contents of register RandN equals to “0”, the path equation with path name “p_0” will be executed. If the contents of register RandN equals to “1,” and the corresponding path encounters “X” (don’t care), the equation will execute the next parameter. If the contents of register RandN equals to “2,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket”[]” is 16. N can be any number from 1 to 3. Mi=data/Mj define the contents of register “Mi” as data or that of register “Mj”, where data can be any value from 0 to 15. Mi=RC_ROTATE(Mj)/LC_ROTATE(Mj) define the contents of register “Mi” as the result of right/left rotation of the contents of register “Mj” with carryflag. The carryflage will be changed. Mi=R_ROTATE(Mj)/L_ROTATE(Mj) define the contents of register “Mi” as the result of right/left rotation of the contents of register “Mj”. Mi=R_SHIFT(Mj)/L_SHIFT(Mj) define the contents of register “Mi” as the result of shifting to right/left the contents of register “Mj”. The MSB/LSB in register “Mi” will be “0”. 62 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Mi=Pn set the contents of Mi as the contents that is read from Pn. Only the pins shown as “O” in the table on Output Port Configuration for EASY-N (Section 5.1.1.2) can be read. Others shown as “X” will set the corresponding bits of Mi as “0”. Mi=DATAL define the contents of register “Mj” as the low nibble data pointed by DP2 in ROM for table-read. Mi=DATAM define the contents of register “Mj” as the middle nibble data pointed by DP2 in ROM for table-read. Mi=DATAH define the contents of register “Mj” as the high nibble data pointed by DP2 in ROM for table-read. The MS 2 bits in register “Mi” will be “0”. Mi=Mj+data/Mj-data define the contents of register “Mi” as the contents of register “Mj” plus/subtract data. Mi=Mj+Mk/Mj-Mk define the contents of register “Mi” as the contents of register “Mj” plus/subtract the contents of register “Mk”. Mi=Mj.and.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” AND data/that of register “Mk”. Mi=Mj.or.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” OR data/that of register “Mk”. Mi=Mj.xor.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” XOR data/that of register “Mk”. Mi=.inv.Mj define the contents of register “Mi” as the result of INVERTing that of register “Mj”. Mi(j)=1/0 define the “jth” bit of register “Mi” as 1/0 where ‘j’ can be any value from 0 to 3. Mi(j)=Pn.x define the “jth” bit of register “Mi” as Pn.x, where ‘j’ can be any value from 0 to 3. Pn.x is the bit shown as “O” in the table on Output Port Configuration for EASY-N (Section 5.1.1.2). EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 63 3 Chapter 5 Pn=Mi/data define the output contents of the Port ‘n’ as the content of Register “Mi” or data. Only the bits shown as “O” ” in the table on Output Port Configuration for EASY-N (Section 5.1.1.2), will be set. Mi?>data:p_name if the contents of register “Mi” is greater than data, the path equation with the path name “p_name” will be executed. Mi?>Mj:p_name if the contents of register “Mi” is greater than the contents of register “Mj”, the path equation with the path name “p_name” will be executed. Mi?<data:p_name if the contents of register “Mi” is less than data, the path equation with the path name “p_name” will be executed. Mi?<Mj:p_name if the contents of register “Mi” is less than the contents of register “Mj”, the path equation with the path name “p_name” will be executed. Mi?>=data:p_name if the contents of register “Mi” is greater than or equal to data, the path equation with the path name “p_name” will be executed. Mi?>=Mj:p_name if the contents of Pn=Mi/data, define the output contents of Port n as the contents of register “Mi” or data. Only the bits shown as “O” in the table on Output Port Configuration for EASY-N (Section 5.1.1.2) will be set. Mi?=data:p_name if the contents of register “Mi” equals to data, the path equation with the path name “p_name” will be executed. Mi?=Mj:p_name if the contents of register “Mi” equals to that of register “Mj”, the path equation with the path name “p_name” will be executed. Mi?<>data:p_name / Mi?!=data:p_name if the contentsof register “Mi” does not equal to data, the path equation with the path name “p_name” will be executed. Mi?<>Mj:p_name / Mi?!=Mj:p_name if the contents of register “Mi” does not equal to that of register “Mj,” the path equation with the path name “p_name” will be executed. 64 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Mi?>data:p_name if the contents of register “Mi” is greater than data, the path equation with the path name “p_name” will be executed. Mi?>Mj:p_name if the contents of register “Mi” is greater than the contents of register “Mj,” the path equation with the path name “p_name” will be executed. Mi?<data:p_name if the contents of register “Mi” is less than data, the path equation with the path name “p_name” will be executed. Mi?<Mj:p_name if the contents of register “Mi” is less than the contents of register “Mj”, the path equation with the path name “p_name” will be executed. Mi?>=data:p_name if the contents of register “Mi” is greater than or equal to data, the path equation with the path name “p_name” will be executed. Mi?>=Mj:p_name if the contents of register “Mi” is greater than or equal to the contents of register “Mj”, the path equation with the path name “p_name” will be executed. Mi?<=data:p_name if the contents of register “Mi” is less than or equal to data, the path equation with the oath name “p_name” will be executed. Mi?<=Mj:p_name if the contents of register “Mi” is less than or equal to the contents of register “Mj”, the path equation with the path name “p_name” will be executed. Mi(j)?=1/0:p_name if the “jth” bit of register “Mi” equals to 1/0, the path equation with the path name “p_name” will be executed. Mi?=[d x d x]:[p_0 x p_2 …] if (Mi(3) and Mi(1) equal to “00,” the path equation with the path name “p_0” will be executed. If Mi(3) and Mi(1) equal to “01,” and the corresponding path encounters “X” (don’t care), the equation will execute the next parameter. If Mi(3) and Mi(1) equals to “10,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommo- dated in the bracket”[]” is 16. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 65 3 Chapter 5 Mi:[p_0 x p_2 …] if the contents of register “Mi” equals to “0,” the path equation with path name “p_0” will be executed. If the contents of register “Mi” equals to “1,” and the corresponding path meets the “X” (don’t care), the equation will execute the next parameter. If the contents of register “Mi” equals to “2,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket”[]” is 16. TRn?=H/L:p_name if the trigger TRn is “H”/”L,” the path equation with path name “p_name” will be executed. ‘n’ can be from 1 to the number N of EASY-N. NOTE This parameter will not work properly when customized keyboard scan routine is used. Pn?=[I’3 I’2 I’1 I’0]:p_name if the I/O pins of Port n are equal to [I’3 I’2 I’1 I’0], the path equation with path name “p_name” will be executed. Where I’3 to I’0 can be “1”, “0” or “x”. The I’3 to I’0 bits shown as “X” in the tables on Output Port Configuration for EASY-N and DIRECT-N (see Section 5.1.1.2) must be “x”. Pn?=[d x d x]:[p_0 x p_2 …] if Pn.3 and Pn.1 are equal to “00,” the path equation with path name “p_0” will be executed. If Pn.3 and Pn.1 are equal to “01,” and the corresponding path meets the “x” (don’t care), the equation will execute the next parameter. If Pn.3 and Pn.1 equal to “10”, the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket “[]” is 16. The bits shown as “X” in tables on Output Port Configuration for EASY-N and DIRECT-N (see Section 5.1.1.2) must be “x” in the bracket of Pn?=[]. The bits shown as “O” in the stated table for EASY-N can be “x” or “d” in the bracket of Pn?=[]. PLAY2?:p_name if an audio file is playing in Channel 2, the path equation with path name “p_name” will be executed. 66 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 MARK2?:p_name if the voice synthesizer accesses the marked sample in Channel 2, the path equation with the path name “p_name” will be executed and the “mark2” flag in DFLAG will set to “1”. RSTM2 reset the “mark2” flag in DFLAG to “0”. CARRY?:p_name if the carryflag is “1,” the path equation with the path name “p_name” will be executed. FV_ON=data define P3.3 as an LED output that will flash synch with audio volume in sinking pattern. If the option is not used, P3.3 will treated as a general-purpose I/O pin. Data =2. FV_OFF turn off LED output flash function. MUTE2 mute the currently playing in Channel 2 with toggle function. PAUSE2 pause the currently playing in Channel2 with toggle function. STOPDA force stop the currently playing in Channel 2. The D/A will be turned off. STOP2 force stop the currently playing in Channel 2. The D/A will keep the final value for Channel 2. INTER enable interpolation function for output voice data. NOINTER disable interpolation function for output voice data. END power down the chip and stop the program CurrentDA?:p_name if the speaker is transistor driven (i.e., constant current D/A output, not direct drive output), the path equation with path name “p_name” will be executed. BK_ENABLE(BackgroundName) enable a background equation defined in [Background] section (Background instruction is described below) BK_DISABLE disable background equation (Background instruction is described below) PWM(n) Select the duty cycle for PWM output from the port of [OutputState]. N can be set from 0 to 8. 0 will stop the output. N 1 2 3 4 5 6 7 8 Duty Cycle 10% 20% 25% 33% 50% 66% 75% 90% EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 67 3 Chapter 5 5.1.1.6 [Background]: BackgroundName : parameter0, parameter1, …, parameterN Background allows the program to execute 2 commands simultaneously. The major flow of a program must defined in [Path] section. Background is applicable only when the program needs to perform two things at the same time. The switching between main path and background path occurs when delay or play command is executed. For example, play voice the in main path and do output in background, or play voice in background and do time out in the main path. Background process is enabled in the main path by BK_ENABLE(name) command and can be disabled by BK_DISABLE. All parameters in [Path] section can be used in [Background] section except BK_ENABLE and BK_DISABLE. The path name in some parameters can only be referenced to the name of background path name. 5.1.2 EASY Options 5.1.2.1 Initial Condition Set the power-on initial condition for output ports. The setting has no effect on the pins marked as “X” in the tables on Output Port Configuration for EASY-N and DIRECT-N (see Section 5.1.1.2) for different EASY types. These pins will set as High when automatically power-on by compiler. 5.1.2.2 Random Three 4-bit registers (RAND1, RAND2, RAND3) are available for your application as a random number register. When the register is checked, N can be set as any number from 2 to 16. Hence, this register is a random number with a range of 0 to N-1. 5.1.2.3 NO_STOP By default, when trigger is received while the chip is playing, it is immediately stopped. If NO_STOP option is defined, playing will continue allowing you to do something else during playback. 5.1.2.4 Debounce Allowing you to define debounce time of keyboard scan. The value N can be set from 1 to 8, thus the debounce time is N*6.8 ms. 68 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 5.1.2.5 Hi-Res Timer This will allow you to use a high resolution (1ms) timer in the application. It is very useful when used with the [TimerAsm] block. 5.1.3 Usable RAM Range The applicable RAM range for different chips under EASY format are as follows: Chip Range EM55001/L EM55002/L EM55100/L EM55200/L~551/L EM55450/L~700/L M0, M1 X M0 ~ M12, M16~M19 M0 ~ M76, M80~M93 M0 ~ M72, M80~M93 If IR-4bit is used, the following RAM’s cannot be used: Chip Range EM55001/L EM55002/L EM55100/L EM55200/L~551/L EM55450/L~700/L No IR in EASY No IR in EASY M16 ~ M19 M80 ~ M83 M80 ~ M83 If IR-16bit is used, the following RAM’s cannot be used: Chip Range EM55001/L EM55002/L EM55100/L EM55200/L~551/L No IR in EASY No IR in EASY M16 ~ M29 M80 ~ M93 EM55450/L~700/L M80 ~ M93 If PWM is used, the following RAM’s cannot be used: Chip Range EM55001/L EM55002/L EM55100/L EM55200/L~551/L EM55450/L~700/L No PWM No PWM No PWM M64 ~ M72 M64 ~ M72 5.1.4 Custom Defined Scankey Routine 5.1.4.1 Why Use Custom Defined Scankey Routine? If you want to use a keyboard configuration other than the one provided by EASY compiler, you can write your own keyboard scan routine and replace the one from EASY compiler. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 69 3 Chapter 5 5.1.4.2 How to Use a Custom Defined Scankey Routine From the Easy Setting dialog of IDE Program, enable the Custom checkbox in the Key Type group box. Then assign your custom defined scankey filename in the File box. Also enter the number of keys and the output configuration for the corresponding ports into their respective boxes. Figure 5-1 “Easy Setting” Dialog for Custom Defined Scankey Routine NOTE The custom defined Scankey file must start with a label called “@@Custom_scankey_start” and end with a command “jmp @@Custom_scankey_end”. The corresponding paths for the pressed and released key are defined as @@TRNR and @@TRNF, where N is the key number to be activated. The following is an example of a typical and simple scankey routine. Note that this is only an illustration of a basic configuration with lot of parameters missing: @@Custom_Scankey_start: nop nop nop nop nop nop nop mov a, p1 caje caje caje caje #1, #2, #4, #8, @@tr1r @@tr2r @@tr3r @@tr4r jmp @@Custom_Scankey_end 70 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 5.2 Summary of Parameters in Path Equation EM55001/L EM55002/L EM55100/L~ 5551/L EM55450/L~700/L EM55000/L Series EASY Parameters EASY EASY DIRECT EASY DIRECT 2,4 6 4~16 20 4~16 20 5~7 8 4~16 20 5~7 8 InputState name √ √ √ √ √ √ √ √ √ √ √ √ OutputState name √ --- √ --- √ √ √ √ √ √ √ √ In-EASY ASM name √ √ √ √ √ √ √ √ √ √ √ √ Path name √ √ √ √ √ √ √ √ √ √ √ √ CH2:Section name √ √ √ √ √ √ √ √ √ √ √ √ [CH2:Section name] √ √ √ √ √ √ √ √ √ √ √ √ CH2:Section name×n √ √ √ √ √ √ √ √ √ √ √ √ [CH2:Section name]×n √ √ √ √ √ √ √ √ √ √ √ √ CH2:FREQ=data √ √ √ √ √ √ √ √ √ √ √ √ VOL22=data/mi √ √ √ √ √ √ √ √ √ √ √ √ DP2:Section name √ √ √ √ √ √ √ √ √ √ √ √ DP2=DP2+data √ √ √ √ √ √ √ √ √ √ √ √ DELAY(n) √ √ √ √ √ √ √ √ √ √ √ √ RATE=n √ √ √ √ √ √ √ √ √ √ √ √ Mi=data/ Mj √ √ √ √ √ √ √ √ √ √ √ √ Mi=RC_ROTATE(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=LC_ROTATE(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=R_ROTATE(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=L_ROTATE(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=R_SHIFT(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=L_SHIFT(Mj) √ √ √ √ √ √ √ √ √ √ √ √ Mi=P2 --- --- --- --- √ --- √ --- √ --- √ --- Mi=P3 √ --- √ --- √ √ √ √ √ √ √ √ Mi=P4 --- --- --- --- --- --- --- --- √ √ √ √ Mi=DATAL √ √ √ √ √ √ √ √ √ √ √ √ Mi=DATAM √ √ √ √ √ √ √ √ √ √ √ √ Mi=DATAH √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj+data/ Mj-data √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj+Mk/ Mj-Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj.and.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.and.Mk √ √ √ √ √ √ √ √ √ √ √ √ EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 71 3 Chapter 5 Mi=Mj.or.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.or.Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj.xor.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.xor.Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=.inv.Mj √ √ √ √ √ √ √ √ √ √ √ √ Mi(j)=1/ 0 √ √ √ √ √ √ √ √ √ √ √ √ Mi(j)=P2.x --- --- --- --- √ --- √ --- √ --- √ --- Mi(j)=P3.x √ --- √ --- √ √ √ √ √ √ √ √ Mi(j)=P4.x --- --- --- --- --- --- --- --- √ √ √ √ P2=Mi/ data --- --- --- --- √ --- √ --- √ --- √ --- P3=Mi/ data √ --- √ --- √ √ √ √ √ √ √ √ P4=Mi/ data --- --- --- --- --- --- --- --- √ √ √ √ RandN?=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?<>data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?<> Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?!= data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?!= Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?> data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?> Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?<data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?< Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?>=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?>= Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?<=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?<= Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN:[p_0 x p_1 …] √ √ √ √ √ √ √ √ √ √ √ √ Mi?=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?<>data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?!=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?<>Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?!=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?>data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?>Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?<data:p_name √ √ √ √ √ √ √ √ √ √ √ √ 72 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Mi?<Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?>=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?>=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?<=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?<=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi(j)?=1/ 0:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?=[d x d x]:[p_0 x p_2…] √ √ √ √ √ √ √ √ √ √ √ √ Mi:[p_0 x p_2...] √ √ √ √ √ √ √ √ √ √ √ √ TRn?=H/ L:p_name √ √ √ √ √ √ √ √ √ √ √ √ P2?=[I’3 I’2 I’1 ’0]: p_name --- --- --- --- √ --- √ --- √ --- √ --- P2?=[d x d x]:[p_0 x p_2…] --- --- --- --- √ --- √ --- √ --- √ --- P3?=[I3 I2 I1 I0]:p_name √ --- √ --- √ √ √ √ √ √ √ √ P3?=[d x d x]:[p_0 x p_2…] √ --- √ --- √ √ √ √ √ √ √ √ P4?=[I3 I2 I1 I0]:p_name --- --- --- --- --- --- --- --- √ √ √ √ P4?=[d x d x]:[p_0 x p_2…] --- --- --- --- --- --- --- --- √ √ √ √ PLAY2?:p_name √ √ √ √ √ √ √ √ √ √ √ √ MARK2?:p_name √ √ √ √ √ √ √ √ √ √ √ √ RSTM2 √ √ √ √ √ √ √ √ √ √ √ √ CARRY?:p_name √ √ √ √ √ √ √ √ √ √ √ √ FV_ON=data √ --- √ --- √ √ √ √ √ √ √ √ FV_OFF √ --- √ --- √ √ √ √ √ √ √ √ MUTE2 √ √ √ √ √ √ √ √ √ √ √ √ PAUSE2 √ √ √ √ √ √ √ √ √ √ √ √ STOPDA √ √ √ √ √ √ √ √ √ √ √ √ STOP2 √ √ √ √ √ √ √ √ √ √ √ √ INTER √ √ √ √ √ √ √ √ √ √ √ √ NOINTER √ √ √ √ √ √ √ √ √ √ √ √ END √ √ √ √ √ √ √ √ √ √ √ √ CurrentDA?:path --- --- --- --- √* √* √* √* √ √ √ √ BK_ENABLE(Name) √ √ √ √ √ √ √ √ √ √ √ √ BK_DISABLE √ √ √ √ √ √ √ √ √ √ √ √ PWM(n) --- --- --- --- √* √* √* √* √ √ √ √ *Not available from EM55100/L EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 73 3 Chapter 5 5.3 Examples of EASY Format® (ESY) Programs Example 1: ONE SHOT (Trigger 1) – Retriggerable by Itself in EASY-4 Format [InputState] ;Statename: Tr1 Tr2 Tr3 Tr4 STATE0: X PATH1 X X [OutputState] OUT0: P3=[0 0 0 0] P2=[0 0 0 0] OUT1: P3=[1 1 1 1] P2=[1 1 1 1] [PATH] PATH0: OUT0 STATE0 END PATH1: OUT1 CH2:ONE.WAV OUT0 END Example 2: ONE SHOT (Trigger 1 to Trigger 4) – Retriggerable by the Other Pins in EASY-8 Format [InputState] ;Statename: Tr1 Tr2 Tr3 Tr4 Tr5 Tr6 Tr7 Tr8 STATE0: P1 P2 P3 P4 X X X X STATE1: X P2 P3 P4 X X X X STATE2: P1 X P3 P4 X X X X STATE3: P1 P2 X P4 X X X X STATE4: P1 P2 P3 X X X X X [OutputState] OUT0: P3=[0 0 0 0] P2=[0 0 0 X] OUT1: P3=[1 1 1 1] P2=[1 1 1 X] [PATH] PATH0: OUT0 STATE0 END P1: OUT1 STATE1 CH2:ONE.WAV OUT0 STATE0 END P2: OUT1 STATE2 CH2:TWO.WAV OUT0 STATE0 END P3: OUT1 STATE3 CH2:THREE.WAV OUT0 STATE0 END P4: OUT1 STATE4 CH2:FOUR.WAV OUT0 STATE0 END 74 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Example 3: LEVEL HOLD (Trigger 1 to Trigger 4) – Repeated Playing, Retriggerable by the Other Pins in EASY-12 Format [InputState] ;Statename: Tr1 Tr2 Tr3 Tr4 Tr5 Tr6 Tr7 Tr8 Tr12 STATE0: P1 P2 P3 P4 X X X X… X STATE1: /P11 P2 P3 P4 X X X X… X STATE2: P1 /P11 P3 P4 X X X X… X STATE3: P1 P2 /P11 P4 X X X X… X STATE4: P1 P2 P3 /P11 X X X X… X [OutputState] OUT0: P3=[0 0 0 0] P2=[0 0 X X] OUT1: P3=[1 1 1 1] P2=[1 1 X X] [PATH] PATH0: OUT0 STATE0 END P1: OUT1 STATE1 CH2:ONE.WAV P1 P2: OUT1 STATE2 CH2:TWO.WAV P2 P3: OUT1 STATE3 CH2:THREE.WAV P3 P4: OUT1 STATE4 CH2:FOUR.WAV P4 P11: OUT0 STATE0 END EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 75 3 Chapter 5 Example 4: LEVEL HOLD (Trigger 1 to Trigger 4) – Unrepeated Playing, Retriggerable by the Other Pins in EASY-20 Format [InputState] ;Statename: Tr1 STATE0: STATE1: STATE2: STATE3: STATE4: Tr2 Tr3 Tr4 Tr5 Tr6 P1 P2 P3 P4 X /P11 P2 P3 P4 X P1 /P11 P3 P4 X P1 P2 /P11 P4 X P1 P2 P3 /P11 X Tr7 X X X X X Tr8… X X X X X Tr20 X…X X…X X…X X…X X…X [OutputState] OUT0: P3=[0 0 0 0] OUT1: P3=[1 1 1 1] [PATH] PATH0: OUT0 STATE0 END P1: OUT1 STATE1 CH2:ONE.WAV OUT0 STATE0 END P2: OUT1 STATE2 CH2:TWO.WAV OUT0 STATE0 END P3: OUT1 STATE3 CH2:THREE.WAV OUT0 STATE0 END P4: OUT1 STATE4 CH2:FOUR.WAV OUT0 STATE0 END P11: OUT0 STATE0 END Example 5: Marked Samples The following example demonstrates a marked sample. When the speech encounters the 1st marked sample, the P3 outputs out 1. Mark code of the section file is set in the Project View window. Refer to Section 3.4.3.2 to see how Mark code is set. [InputState] INI: TR1 [OutputState] OUT0:P3=[0 0 0 0] OUT1:P3=[0 0 0 1] [PATH] PATH0: OUT0 INI END TR1: CH2:FREQ=8K [CH2:1.WAV] KEY: SCANKEY PLAY1?:CHECK END CHECK: MARK2?:CLEAR KEY CLEAR: RSTM2 OUT1 KEY 76 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Example 6: Data Pointer The following example emphasis the data pointer. Tt.tbl is the table file example. [InputState] INI: TR1 [OutputState] OUT0:P3=[ 0 0 0 0] P2=[0 0 0 0] [PATH] PATH0: OUT0 INI END TR1: DP2:TT.TBL LOOP:DP2=DP2+1 M0=DATAL M1=DATAM M2=DATAH & P2=M0 P3=M1 M1?>=15:OVER LOOP OVER:OUT0 END The following displays the “tt.tbl” file format. 000H 088H 000H 111H 222H 199H 2AAH 111H……… EM55000/S/L Series IDE User’s Guide 333H 3BBH 044H 0CCH 155H 1DDH 266H 2EEH 377H 3FFH Processing ESY Programs for EM55000/L Series • 77 3 Chapter 5 Example 7: Use the Current D/A to Determine Whether to Add Raising and Falling Waveform or Not We usually add a rising waveform at the beginning of a playing voice if the speaker is transistor driven. This is however, not required for direct drive speaker. Attempt to do so will only generate undesirable noise. Thus, the instruction “CurrentDA” is made available to provide you with a control on when to add or not to add a raising and falling waveform according to connected speaker status. The following example demonstrates the usage of CurrentDA . [InputState] INI: TR1 [OutputState] OUT0:P3=[ 0 0 0 0] P2=[0 0 0 0] [PATH] PATH0: OUT0 INI CH2:FREQ=8K END TR1: CurrentDA?:Play_raising Play_voice Play_raising:CH2:FREQ=4K CH2:raising.wav Play_voice: CH2:FREQ=8K CH2:1.wav CH2:2.wav Play_dec: CurrentDA?:Play_falling Play_end Play_falling: CH2:FREQ=4K CH2:falling.wav Play_end: END 78 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 Example 8: Background Usage Example – Play in the Main Path and Output in Background The trigger “gr1” output flash by calling OutputState path in the main path with sequential parameters. The trigger “gr2” do the same action as “gr1” but set output in the background path. [InputState] IN1: gr1 gr2 [OutputState] out_clear: p2=[ 1 1 1 1] p3=[ 1 1 1 1] out_flash: p3=[p- p+ p- p+] [PATH] Path0:in1 ch2:freq=6000 gr1: ch2:freq=6000 delay(0.1) Ch2:merry_xmas6k.wav end bk_disable out_clear Ch2:merry_xmas6k.wav & rate=8 out_flash ch2:we_wish_xmas6k.wavx2 out_clear delay(0.1) & ch2:heppy_newyear6k.wav delay(0.3) end gr2: ch2:freq=6000 delay(0.1) bk_disable out_clear Ch2:merry_xmas6k.wav & bk_enable(led_flash) ch2:bell6k.wavx2 out_clear delay(0.1) & ch2:heppy_newyear6k.wav delay(0.3) end bk_disable [Background] led_flash: p3=5 delay(0.5) p3=10 delay(0.5) led_flash EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 79 3 Chapter 5 5.4 Application Circuit 5.4.1 EM55001/L Format Maximum Trigger Number EASY-2 2 P3.3, P3.2 EASY-4 4 P3.3 EASY-6 6 N/A I/O Pin Available The application circuits for each format are illustrated below. VCC VCC NPN 8050 VDD VO OSCI P33 P32 P20 VSSD VCC P21 TR1 TR2 Figure 5-2a EM55001/L EASY-2 Application Circuit 80 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 VCC VCC NPN 8050 VDD VO OSCI P33 P32 P20 VSSD VCC P21 TR3 TR1 TR2 TR4 Easy - 4 Application Circuit Figure 5-2b EM55001/L EASY-4 Application Circuit VCC VCC NPN 8050 VDD VO OSCI P33 P32 P20 VSSD VCC P21 TR1 TR2 TR3 TR5 TR4 TR6 Easy - 6 Application Circuit Figure 5-2c EM55001/L EASY-6 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 81 3 Chapter 5 5.4.2 EM55002/L Format Maximum Trigger Number EASY-4 4 P3.3, P3.2, P3.1, P3.0 EASY-8 8 P3.3, P3.2, P3.1 EASY-12 12 P3.3 , P3.2 EASY-16 16 P3.3 EASY-20 20 N/A I/O Pin Available The application circuits for each format are illustrated below. VCC VCC VCC VDD VO1 VO OSC TEST P33 P32 P31 P30 VCC VSSD VSSC TR1 P20 P21 P22 P23 TR2 TR3 TR4 Easy - 4 Application Circuit Figure 5-3a EM55002/L EASY-4 Application Circuit 82 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 VCC VCC VCC VDD VO1 VO OSC TEST P33 P32 P31 P30 VCC VSSD VSSC TR5 TR1 P20 P21 P22 P23 TR2 TR6 TR3 TR7 TR4 TR8 Easy - 8 Application Circuit Figure 5-3b EM55002/L EASY-8 Application Circuit VCC VCC VCC VDD VO1 VO OSC TEST P33 P32 P31 P30 VSSD VSSC P20 P21 P22 P23 VCC TR5 TR9 TR2 TR6 TR10 TR3 TR7 TR11 TR4 TR8 TR12 TR1 Easy - 12 Application Circuit Figure 5-3c EM55002/L EASY-12 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 83 3 Chapter 5 VCC VCC VCC VDD VO1 VO OSC TEST P33 P32 P31 P30 VCC VSSD VSSC TR5 TR9 TR13 TR2 TR6 TR10 TR14 TR3 TR7 TR11 TR15 TR4 TR8 TR12 TR16 TR1 P20 P21 P22 P23 Easy - 16 Application Circuit Figure 5-3d EM55002/L EASY-16 Application Circuit VCC VCC VCC VDD VO1 VO Easy - 20 Application Circuit OSC TEST P33 P32 P31 P30 VSSD VSSC P20 P21 P22 P23 VCC TR5 TR9 TR13 TR17 TR2 TR6 TR10 TR14 TR18 TR3 TR7 TR11 TR15 TR19 TR4 TR8 TR12 TR16 TR20 TR1 Figure 5-3e EM55002/L EASY-20 Application Circuit 84 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 5.4.3 EM55100/L ~ EM55700/L Format Maximum Trigger Number Available I/O Pin EASY-4 4 P4.3~P4.0; P3.3~P3.0; P2.3~P2.0 Direct-5 5 P4.3~P4.0; P3.3~P3.0; P2.3~P2.1 Direct-6 6 P4.3~P4.0; P3.3~P3.0; P2.3, P2.2 Direct-7 7 P4.3~P4.0; P3.3~P3.0; P2.3 Direct-8 8 P4.3~P4.0; P3.3~P3.0 EASY-8 8 P4.3~P4.0; P3.3~P3.0; P2.3~P2.1 EASY-12 12 P4.3~P4.0; P3.3~P3.0; P2.3,P2.2 EASY-16 16 P4.3~P4.0; P3.3~P3.0; P2.3 EASY-20 20 P4.3~P4.0; P3.3~P3.0 P4.3, P4.2, P4.1, and P4.1 are applicable and used with EM55450/L~EM55700/L only The application circuits for each format are illustrated below. VCC P40 P41 P42 P43 VCC VDD VO1 VO OSCI Rosc OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 P23 P22 P21 P20 Easy-4 Application Circuit VCC TR1 TR2 TR3 TR4 Figure 5-4a EM55100/L ~ EM55700/L EASY-4 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 85 3 Chapter 5 P40 P41 P42 P43 VCC VCC VDD VO1 VO OSCI Rosc OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 Easy-8 Application Circuit P23 P22 P21 P20 VCC TR1 TR5 TR2 TR6 TR7 TR3 TR8 TR4 Figure 5-4b EM55100/L ~ EM55700/L EASY-8 Application Circuit VCC P40 P41 P42 P43 VCC VDD VO1 VO OSCI Rosc OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 Easy-12 Application Circuit P23 P22 P21 P20 VCC TR1 TR5 TR9 TR2 TR6 TR10 TR3 TR7 TR11 TR4 TR8 TR12 Figure 5-4c EM55100/L ~ EM55700/L EASY-12 Application Circuit 86 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 VCC P40 P41 P42 P43 VCC VDD VO1 VO OSCI Rosc Easy-16 Application Circuit OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 P23 P22 P21 P20 VCC TR1 TR5 TR9 TR13 TR2 TR6 TR10 TR14 TR3 TR7 TR11 TR15 TR4 TR8 TR12 TR16 Figure 5-4d EM55100/L ~ EM55700/L EASY-16 Application Circuit VCC P40 P41 P42 P43 VCC VDD VO1 VO OSCI Rosc OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 Easy-20 Application Circuit P23 P22 P21 P20 VCC TR1 TR5 TR9 TR13 TR17 TR2 TR6 TR10 TR14 TR18 TR3 TR7 TR11 TR15 TR19 TR4 TR8 TR12 TR16 TR20 Figure 5-4e EM55100/L ~ EM55700/L EASY-20 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 87 3 Chapter 5 VCC VCC P40 P41 P42 P43 VCC VDD OSCI OSCO TEST VSSD VSSC P13 P12 P11 P10 VO1 VO P33 P32 P31 P30 P23 P22 P21 P20 VCC VCC TR1 TR2 TR3 TR4 TR5 Direct - 5 Application Circuit Figure 5-4f EM55100/L ~ EM55700/L Direct-5 Application Circuit VCC VCC P40 P41 P42 P43 VCC VDD OSCI OSCO TEST VSSD VSSC P13 P12 P11 P10 VO1 VO P33 P32 P31 P30 P23 P22 P21 P20 VCC VCC TR1 TR2 TR3 TR6 TR4 TR5 Direct - 6 Application Circuit Figure 5-4g EM55100/L ~ EM55700/L Direct-6 Application Circuit 88 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 5 VCC VCC P40 P41 P42 P43 VCC VDD OSCI OSCO TEST VSSD VSSC P33 P32 P31 P30 VO1 VO P23 P22 P21 P20 VCC TR7 P13 P12 P11 P10 TR6 TR5 TR4 TR3 TR2 TR1 Direct - 7 Application Circuit Figure 5-4h EM55100/L ~ EM55700/L Direct-7 Application Circuit VCC VCC P40 P41 P42 P43 VCC VDD OSCI OSCO TEST VSSD VSSC P33 P32 P31 P30 VO1 VO VCC TR8 P23 P22 P21 P20 TR7 P13 P12 P11 P10 TR6 TR5 TR4 TR3 TR2 TR1 Direct - 8 Application Circuit Figure 5-4i EM55100/L ~ EM55700/L Direct-8 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000/L Series • 89 3 Chapter 5 90 • Processing ESY Programs for EM55000/L Series EM55000/S/L Series IDE User’s Guide Chapter 6 Chapter 6 Processing ASM Programs for EM55000S Series 6.1 Writing an Assembly (ASM) Program 6.1.1 File Format The following is an example of an Assembly file format for EM55000S series. INCLUDE “define.inc” pageA EQU page1 temp EQU m0 … … main: … … SetP2 MACRO P2Value, P2SValue mov rate2, 6k mov a, P2Value play2 mov P2, a … mov a, P2Svalue … mov P2S, a song1.wav ENDM PowerOn: SetP2 jmp #0000b, #1111b main Init: pageA mov a, temp inca EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series 91 3 Chapter 6 6.1.1.1 File Structure The Assembly project supports multiple-files features, whereby, a program can be separated into several numbers of files. All labels defined for each file within the same project must be unique and contain the power conservation signal labels POWERON and INIT. POWERON is where the program operation starts after power (i.e., battery) is switched on. INIT is the starting point where program operation starts or wakes-up after a power-down or sleep mode period. NOTE “Wake-up” is initiated whenever a rising/falling edge pulse is provided to Port 2 during sleep mode or power-down period. “Wake-up” is initiated whenever a rising/falling edge pulse occurs at Pin P2.1 without invoking the flash with volume function for EM55003S. For EM55003S, Pin P2.1 “wake-up” function is disabled when the flash with volume function is invoked. 6.1.1.2 Statement Line An assembly program is written in statement lines. A statement line has the following format: [Label:] Mnemonic [Operand1 [,Operand2…] ] [;Comment] Where: Label: Label definition must be followed by a colon (:). Mnemonic: Including OpCode and Macro name. Operands: Memory notation or constant value. Comment: Starts with a semi-colon (;), all words after the semi-colon (;) are ignored by assembler. All words are case-insensitive within the program. 6.1.1.3 Section Definition All the voice requirements for your application are defined in the project. The processes of adding section files and setting up section properties are defined in Section 3.4.3.2 in Chapter 3. 92 • Processing ASM Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 6 6.1.2 Control Register The following are the control registers in EM55000S series chips: STATUS FMODE 2 2 Figure 6-1 EM55000S Series Control Registers 6.1.2.1 STATUS (Play Flag, Timer Overflow Flag) Bit Name Reset Wake-up 0 1 Ch2flag 0 0 2 Timerflag 0 0 3 Description Unused 1: ch2 is playing 0: ch2 is not playing 1: timer is overflowing 0: timer is not overflowing Unused STOP2: Stop ch2’s playing, reset Ch2flag and keep the final value of ch2 in D/A. RSTTF: Reset Timerflag. (NOTE: This does not reset timer. It is different from EM58000 series. EM550000S can use instruction “MOV TIMER, #” to clear timer counter.) NOTE The sample rate of ch2 is affected by register RATE. 6.1.2.2 FMODE (Flash Mode) Bit Name Reset 0 1 Voice2f 0 2 3 P21 : P33 : IRf 0 Wake-up Description Unused 1: voice flash of ch2 enabled Unchanged 0: voice flash of ch2 disabled Unused 1: 38 KHz signal enabled while P32 is in output state Unchanged 0: 38 KHz signal disabled while P32 is in output state Flash with volume function for EM55003S. Flash with volume function for EM55005S/7S/9S/12S/15S. If Voice2f = 0, P2.1/P3.3 will be treated as a general purpose I/O pin. Otherwise, it will be treated as an LED output that flashes with volume if Voice2f is enabled. The flash LED must be connected between Vcc and Pin P2.1/P3.3 in sinking pattern. NOTE : 1. If you use P2.1/P3.3 as an LED output by setting Voice2f to “1,” it is recommended that you change Voice2f status to “0” every time the chip switches to power-down (sleep) mode. More energy can be saved this way when chip is under sleep mode. 2. EM55005S ~ EM55015S support IR feature. 3. The IR Receiver Pin for EM55005S ~ EM55009S is P2.2 and P2.3 is for EM55012S ~ EM55015S (see Appendix C1). EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series 93 3 Chapter 6 6.1.3 I/O Registers P2S P2 2/4 P3S P3 2 2/4 2 Figure 6-2 EM55000S Series I/O Registers NOTE P2 and P2S have 2 bits only with EM55003S (P2.0, P2.1) P3 and P3S are not available with EM55003S 6.1.3.1 P2 (P2 Register) Name Reset Wake-up P2 0000b No Change 6.1.3.2 P2S (P2 Status Register) Name P2S Reset 1111b Wake-up Description No Change 1: the corresponding bit is of tri-state 0: the corresponding bit is “1” or “0” in consistent with the content of Register P2 6.1.3.3 P3 (P3 Register) Name Reset Wake-up P3 0000b No Change 6.1.3.4 P3S (P3 Status Register) Name P3S Reset 1111b Wake-up Description No Change 1: the corresponding bit is of tri-state 0 the corresponding bit is “1” or “0” in consistent with the content of Register P3 NOTE To conserve more energy during power-down (sleep) mode, P2/P3 must NOT be floating when their corresponding P2S/P3S bit is set to “1”. 94 • Processing ASM Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 6 6.1.4 Assembler Directives The Assembler provides several directives as summarized below. DEFINE / UNDEF : Define/Undefine a Symbol DEFINE <sym1> UNDEF <sym2> Define/undefine a symbol to make the symbol available for IFDEF directive under different assembly conditions. EQU : Replace Value/String with a Specified Symbol Name <label> EQU <constant> <label> EQU <string> Replace a value or string with a specified symbol name. Programmer may use established symbol names to make the program more readable. Example: A1 EQU #08h A2 EQU M1 IFDEF, ELSEIFDEF, ELSE, ENDIF : Conditional Assembly IFDEF <sym1> < statements for sym1 defined > [ELSEIFDEF sym2 < statements for sym2 defined >] [ELSE < statements for sym2 and sym2 not defined >] ENDIF (related : IFNDEF, IF) The assembler only assembles the block where the symbol is defined after the directive. Nested condition is not supported, that is, do not use another IF condition in an IF block. EM55000/S/L Series IDE User’s Guide Processing ASM Programs for EM55000/L Series 95 3 Chapter 6 INCLUDE : Include Files INCLUDE “filename” Use to include files containing symbol definition, macro, or procedure definition, etc. An include file can include other “Include file,” but the maximum include depth should not exceed 8 levels. Assembler will initially searches the file in the path where the source file is located. If not found, it will search from the directory where the IDS Coding Program is located. Please do not include files that are already added in the project. Macro / ENDM: Macro Definition <label> MACRO [<param1>,…,<paramn>] <statements> ENDM Macro must be defined before use. Calling other macro in a macro definition is allowed but it is not valid to define a new macro within a macro definition block or calling the macro itself (recursive). The max level of macro call is 8. Local labels in a macro must start with ‘$’ and should be followed by a sequence of 3-digit numbers after expansion Example 1: MAC1 MACRO XXX $LOCAL: XXX ENDM ($LOCAL will be $LOCAL001 in the first macro expansion and $LOCAL002 in the second.) Example 2: Definition Mac1 Macro Para1, Para2 mov a, Para1 mov p2s, a mov a, Para2 mov p2, a EndM Usage SetPort: … Mac1 #0000b, #1111b … Expansion SetPort: … mov mov mov mov a, #0000b p2s, a a, #1111b p2, a … 96 • Processing ASM Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 6 6.1.5 Assembly Program Instruction Set NOTE In the following instructions, the data value can be 0 ~ 15 or 0000b ~ 1111b, and the M? value can be M0 ~ M15 Symbol Description Remarks Play the voice file named “sec” at ch2 in normal mode. Set the content of the Data Pointer 2 (DP2) as the initial address of the table file named “sec” in table-read mode PLAY2 sec PAUSE2 *1 Pause/unpause ch2’s playing MOV RATE2, #data *2 Transfer immediate data to RATE2 register MOV TIMER, #data *3 Transfer immediate data to TIMER register and clear timer counter The sample rate will be affected by register RATE2 --The content of Register A will be modified The content of Register A will be modified. (For EM55000S, this instruction will also clear timer counter. This is the major difference between EM55000S and EM55000/EM58000 series) MOV A, STATUS Transfer data from STATUS register to Register A --- STOP2 Stop ch2’s playing, reset Ch2flag, and VOVO1 status will change to ”Low” --- MOV FMODE, A Transfer data from Register A to FMODE register --- MOV A, P2 MOV P2S, A MOV P2, A Transfer data from Port 2 to Register A Transfer data from Register A to status register of Port 2 Transfer data from Register A to Port 2 The MS 2 bits in Register A will be “0” for EM55003S The MS 2 bits in Register A must be set to “0” for EM55003S MOV A, #data Transfer immediate data to Register A MOV A, M? Transfer data from memory to Register A MOV M?, #data Transfer immediate data to memory MOV M?, A Transfer data from Register A to memory --- AND A, M? (A) and (M?) ---> (A) --- OR A, M? (A) or (M?) ---> (A) --- EM55000/S/L Series IDE User’s Guide Data value can be 0 ~ 15 or 0000b ~ 1111b, and the M? value can be M0 ~ M15 for these instructions Processing ASM Programs for EM55000/L Series 97 3 Chapter 6 XOR A, M? (A) xor (M?) ---> (A) --- INCA (A) +1 ---> (A) --- JMP label Change program location to “label” --- CAJE #data, label If (A) = immediate data, then change program location to “label” --- CAJE M?, label If (A) = (M?), then change program location to “label” --- CALL label Call subroutine RET Return from subroutine --- PAGE0 Select first page memory --- PAGE1 Select second page memory --- PAGE2 Select third page memory Not applicable to EM55003S/005S PAGE3 Select forth page memory Not applicable to EM55003S/005S/007S/009S END Enter power-down mode --- NOP No operation --- NOTES: There are two levels of subroutine call *1 If the audio file is in Pause mode, the play flag (Ch2flag) will remain at “1.” A new Play instruction will end the previous audio file Pause status and play the new audio file. *2 “MOV RATE2, #data” is used to determine the sample rate of the voice playing at ch2. The available voice sample rates are as follows: 3750 4280 5000 6000 7500 10000 15000 #Data can be 3.7K, 4.2K, 5K, 6K, 7.5K, 10K and 15K to represent 3750, 4280, 5000, ETC., playing speed respectively. Furthermore, #Data can be a real integer between #3750 and #15000 to represent playing speed (Hz). The IDS tool will look for the value that is the nearest to the above mentioned sample rates in executing the play command. *3. “MOV TIMER, #data” is used to determine the speed of the internal timer. The value of data can be one of the following: Data Overflow time 0 1 2 3 1.04 ms 2.08 ms 4.16 ms 8.32 ms 98 • Processing ASM Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 Chapter 7 Processing ESY Programs for EM55000S Series 7.1 Writing an EASY Format® (ESY) Program 7.1.1 File Format [InputState] … … [OutputState] … … [Path] Path0: … … [Background] … … [Asm] … [TimerAsm] … The EASY program does not support multifile. An EASY format source file consisted of several blocks, i.e., InputState, OutputState, Path, Asm, and Background. The blocks can be written in different order and all words are case-insensitive. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 99 3 Chapter 7 7.1.1.1 [InputState]: StateName : PathName1, PathName2, …, PathNameN InputState is defined for each input trigger state assignment. You can define up to 256 states with different input state names. The state name must be followed by the ‘N’ trigger of selection options, where N is the option selected in the project for EASY-N setting. The trigger selection options can be one of the following: p_name when the corresponding trigger is invoked (or pressed in case of keypad), the path equation with path name “p_name” is executed. /p_name when the corresponding trigger is released, the path equation with path name “p_name” is executed. p_name1/p_name2 X when the corresponding trigger is invoked (or pressed in case of keypad), the path equation with path name “p_name1” is executed. When the corresponding trigger is released, the path equation with path name “p_name2” is executed. disable the corresponding trigger (no action). 100 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 7.1.1.2 [OutputState]: OutputName : P3=[O3 O2 x x ] P2=[O3 O2 O1 O0] OutputState is the set output state of the available port. Note that P3 cannot be set with EM55003S. Moreover, the usage of ports will depend on the type of trigger selected under EASY-N or DIRECT-N. “O3, O2, O1, and O0” stand for Pn.3, Pn.2, Pn.1, and Pn.0 respectively. Each pin may be defined as follows: 1 0 P+ P– S+ S– F X set the corresponding I/O pin as “H” set the corresponding I/O pin as “L” send a pulse train beginning from “H” to the corresponding I/O pin send a pulse train beginning from “L” to the corresponding I/O pin send a positive pulse to the corresponding I/O pin send a negative pulse to the corresponding I/O pin set the designated I/O pins as tri-state keep unchanged the current state of the corresponding output pin or used as “not used” pin Output Port Configuration for EASY-N EM55003S EASY-1 P2=[X,X,O,X] EM55005S/07S/09S EASY-2 P3=[O,O,X,X] EM55005S/07S/09S EASY-4 P3=[O,X,X,X] EM55012S/015S EASY-3 P3=[O,O,0,X] EM55012S/015S EASY-6 P3=[O,O,X,X] EM55012S/015S EASY-9 P3=[O,X,X,X] Where: O : can be used as output pin. X : can not be used as output pin. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 101 3 Chapter 7 7.1.1.3 [Asm]: In-EASY Assembly [ASM] AsmName1_BEGIN: <statements> label: <statements> AsmName1_END M AsmName2_BEGIN: <statements> AsmName2_END In-EASY assembly provides a block for users to write assembly code in EASY format. The syntax of In-EASY assembly is the same as the assembly language described in Chapter 6, but without assembly directives. In-EASY assembly can use local label in its definition block. The In-EASY assembly definition starts from a name designation of “_Begin” and end with “_End”. The name is used in Path or Background section to execute the assembly block. The following instructions should not be used in the In-EASY assembly to avoid influencing the EASY internal routine: “play2 section”, “mov timer, a”, “call”, “ret” “end”. 102 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 7.1.1.4 [TimerAsm]: TimerAsm block provides an entry point for user defined routine to be automatically executed at every timer overflow. This is a special arrangement within the In-EASY assembly whereby you need not bother to take any action at every timer overflow. With the “Hi-Res Timer” setting, this piece of codes is executed at every 1ms, which is almost 8 times more than normal routine. A piece of assembly code is written in this block. Unlike the format used under In-EASY assembly block, “XXX_Begin” and “XXX_End” are not required for block definition. NOTE “Hi-Res Timer” is NOT applicable to EM55005S 7.1.1.5 [Path]: PathName : parameter0, parameter1,…,parameterN Users can define as many path equations as needed and assign each with different path names, i.e., p_name1, p_name2, etc. The path name “path0” must exist in an EASY program as the start of the program. Each path equation line should contain less than 255 characters. If a line is inadequate to define a path equation, additional lines may be added. But the additional lines must begin with an ampersand (&) to indicate it is a continuation to previous line of the same path equation definition. Each path equation definition may contain one or more of the following parameters as may be required: InputState Name activate the input state as defined in [InputState] section OutputState Name set output port as the name to be defined in [OutputState] section Path Name jump to the other path as defined in the [Path] section Asm Name call the In-EASY assembly block defined in [Asm] block CH2:Section name play the voice file in Channel 2. It will call the scan loop and execute the next parameter till the playing stops EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 103 3 Chapter 7 [CH2:Section name] play the voice file in Channel 2 without calling the scan loop nor executing the next parameter immediately CH2:Section name x N play the voice file in Channel 2 and repeat N times [CH2:Section name] x N play the voice file that is repeated N times in Channel 2 without calling the scan loop CH2:FREQ=data define the playing speed of the voice file in Channel 2. “Data” could be either “3.7K”, “4.2K”, 5K”, “6K”, “7.5K”, “10K” or “15K”, to represent 3.7KHz, 4.3KHz, … 15KHz playing speed respectively. Furthermore, it could be the real integer number of 3750, 4280, 5000, 6000, 7500, 10000 and 15000 that will represent the playing speed (Hz) DELAY(n) delay “n” seconds. The minimum delay unit is 0.008 seconds. For example, Delay(0.2) means 0.2 second delay and Delay(8.6) means 8.6 seconds delay RATE=n define the flash rate of flash output pins that are set to “P+” or “P–“. N can be any number from 1 to 8 of the eight flash rate variables 16/n Hz. RandN?=data/Mj:p_name if the contents of register RandN equals to data/register “Mj” contents, the path equation with the path name “p_name” will be executed. N can be any number from 1 to 3 RandN:[p_0 x p_2 …] if the contents of register RandN equals to “0”, the path equation with path name “p_0” will be executed. If the contents of register RandN equals to “1,” and the corresponding path encounters “X” (don’t care), the equation will execute the next parameter. If the contents of register RandN equals to “2,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket”[]” is 16. N can be any number from 1 to 3. Mi=data/Mj define the contents of register “Mi” as data or that of register “Mj”, where data can be any value from 0 to 15. 104 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 Mi=P2 set the contents of Mi as the contents that is read from P2. Only the pins shown as “O” in the table on Output Port Configuration for EASY-N (Section 7.1.1.2) can be read. The others shown as “X” will set the corresponding bits of Mi as “0”. Mi=P3 set the contents of Mi as the contents that is read from P3. Only the pins shown as “O” in the table on Output Port Configuration for EASY-N (Section 7.1.1.2) can be read. The others shown as “X” will set the corresponding bits of Mi as “0”. Mi=Mj+data/Mj-data define the contents of register “Mi” as the contents of register “Mj” plus/subtract data. Mi=Mj.and.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” AND data/that of register “Mk”. Mi=Mj.or.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” OR data/that of register “Mk”. Mi=Mj.xor.data/Mj.and.Mk define the contents of register “Mi” as the contents of register “Mj” XOR data/that of register “Mk”. Mi=.inv.Mj define the contents of register “Mi” as the result of INVERTing that of register “Mj”. Mi(j)=1/0 define the “jth” bit of register “Mi” as 1/0 where ‘j’ can be any value from 0 to 3. P2=Mi/data define the output contents of te Port N as the content of Register “Mi” or data. Only the bits shown as “O” ” in the table on Output Port Configuration for EASY-N (Section 7.1.1.2), will be set. P3=Mi/data define the output contents of Port N as the content of Register “Mi” or data. Only the bits shown as “O” ” in the table on Output Port Configuration for EASY-N (Section 7.1.1.2), will be set. Mi?=data:p_name if the contents of register “Mi” equals to data, the path equation with the path name “p_name” will be executed. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 105 3 Chapter 7 Mi?=Mj:p_name if the contents of register “Mi” equals to that of register “Mj”, the path equation with the path name “p_name” will be executed. Mi(j)?=1/0:p_name if the “jth” bit of register “Mi” equals to 1/0, the path equation with the path name “p_name” will be executed. Mi?=[d x d x]:[p_0 x p_2 …] if (Mi(3) and Mi(1) equal to “00,” the path equation with the path name “p_0” will be executed. If Mi(3) and Mi(1) equal to “01,” and the corresponding path encounters “X” (don’t care), the equation will execute the next parameter. If Mi(3) and Mi(1) equals to “10,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket”[]” is 16. Mi:[p_0 x p_2 …] if the contents of register “Mi” equals to “0,” the path equation with path name “p_0” will be executed. If the contents of register “Mi” equals to “1,” and the corresponding path meets the “X” (don’t care), the equation will execute the next parameter. If the contents of register “Mi” equals to “2,” the path equation with path name “p_2” will be executed, so on and so forth. The maximum number of path names that can be accommodated in the bracket”[]” is 16. TRn?=H/L:p_name if the trigger TRn is “H”/”L,” the path equation with path name “p_name” will be executed. ‘n’ can be from 1 to the number N of EASY-N. NOTE This parameter will not work properly when customized keyboard scan routine is used. PLAY2?:p_name if an audio file is playing in Channel 2, the path equation with path name “p_name” will be executed. 106 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 FV_ON=data define P3.3 (P2.1 in EM55003S) as an LED output that will flash synch with audio volume in sinking pattern. If the option is not used, P3.3 (P2.1 in EM55003S) will be treated as a general-purpose I/O pin. Data =2. FV_OFF turn off LED output flash function. PAUSE2 pause the currently playing in Channel 2 with toggle function. STOP2 force stop the currently playing in Channel 2. The D/A will keep the final value for Channel 2. END power down the chip and stop the program BK_ENABLE(BackgroundName) enable a background equation defined in [Background] section (see Background instruction below) BK_DISABLE disable background equation (see Background instruction below) 7.1.1.6 [Background]: (Not supported by EM55005S) BackgroundName : parameter0, parameter1, …, parameterN Background allows the program to execute 2 commands simultaneously. The major flow of a program must defined in [Path] section. Background is applicable only when the program needs to perform two things at the same time. The switching between main path and background path occurs when delay or play command is executed. For example, play voice the in main path and do output in background, or play voice in background and do time out in the main path. Background process is enabled in the main path by BK_ENABLE(name) command and can be disabled by BK_DISABLE. All parameters in [Path] section can be used in [Background] section except BK_ENABLE and BK_DISABLE. The path name in some parameters can only be referenced to the name of background path name. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 107 3 Chapter 7 7.1.2 EASY Options 7.1.2.1 Initial Condition Set the power-on initial condition for output ports. The setting has no effect on the pins marked as “X” in the tables on Output Port Configuration for EASY-N and DIRECT-N (see Section 7.1.1.2) for different EASY types. These pins will set as High when automatically powered-on by compiler. 7.1.2.2 Random Three 4-bit registers (RAND1, RAND2, and RAND3) are available for your application as a random number register. When the register is checked, N can be set as any number from 2 to 16. Hence, this register is a random number with a range of 0 to N-1. 7.1.2.3 NO_STOP By default, when trigger is received while the chip is playing, it is immediately stopped. If NO_STOP option is defined, playing will continue allowing you to do something else during playing. 7.1.2.4 Debounce Allowing users to define debounce time of keyboard scan. The value N can be set from 1 to 8, thus the debounce time is N*6.8 ms. 7.1.2.5 Hi-Res Time (Not supported by EM55005S) This will allow you to use a high resolution (1ms) timer in the application. It is very useful when used with the [TimerAsm] block is defined. 7.1.3 Usable RAM Range The applicable RAM range for EM55000S series under EASY format is as follows: Chip Range EM55003S EM55005S M0~M4 M0~M7 EM552007S/009S EM55012S/015S M0 ~ M13, M16~M19 M0 ~ M29, M32~M35 If IR function is used, the following RAM can not be used: Chip Range EM55003S EM55005S No IR M4~M7 108 • Processing ESY Programs for EM55000S Series EM552007S/009S EM55012S/015S M16~M19 M32~M35 EM55000/S/L Series IDE User’s Guide Chapter 7 7.1.4 Custom Defined Scankey Routine 7.1.4.1 Why use Custom Defined Scankey Routine? If you want to use a keyboard configuration other than the one provided by EASY compiler, you can write your own keyboard scan routine and replace the one from EASY compiler. 7.1.4.2 How to Use a Custom Defined Scankey Routine? From the Easy Setting dialog of the IDS Coding Program, enable the Custom checkbox in the Key Type group box. Then assign your custom defined scankey filename in the File box. Also enter the number of keys and the output configuration for the corresponding ports into their respective boxes. Figure 7-1 “Easy Setting” Dialog for Custom Defined Scankey Routine NOTE The custom defined Scankey file must start with a label called “@@Custom_scankey_start:” and end with a command “jmp @@Custom_scankey_end”. EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 109 3 Chapter 7 The corresponding paths for the pressed and released key are defined as @@TRNR and @@TRNF, where N is the key number to be activated. The following is an example of a typical and simple scankey routine. Note that this is only an illustration of a basic configuration with lot of parameters missing: @@Custom_Scankey_start: nop nop nop nop nop nop nop mov a, p1 caje #1, @@tr1r caje #2, @@tr2r caje #4, @@tr3r caje #8, @@tr4r jmp @@Custom_Scankey_end 110 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 7.2 Summary of Parameters in Path Equation EM55000S Series Parameters EM55003S EM55005S EM007S, 009S EM55012S, 015S EASY EASY EASY EASY 1 2 2 4 6 2 4 6 3 6 9 12 √ √ √ √ √ √ √ √ √ √ √ --- √ √ --- √ √ --- √ √ In-EASY ASM name √ √ √ √ √ √ √ √ √ √ √ Path name √ √ √ √ √ √ √ √ √ √ √ CH2:Section name √ √ √ √ √ √ √ √ √ √ √ [CH2:Section name] √ √ √ √ √ √ √ √ √ √ √ InputState name OutputState name --- CH2:Section name×n √ √ √ √ √ √ √ √ √ √ √ √ [CH2:Section name]×n √ √ √ √ √ √ √ √ √ √ √ √ CH2:FREQ=data √ √ √ √ √ √ √ √ √ √ √ √ DELAY(n) √ √ √ √ √ √ √ √ √ √ √ √ RATE=n √ --- √ √ √ √ √ √ √ √ √ √ Mi=data/ Mj √ √ √ √ √ √ √ √ √ √ √ √ Mi=P2 √ --- --- --- --- --- --- --- --- --- --- --- Mi=P3 --- --- √ √ --- √ √ --- √ √ Mi=Mj+data/ Mj-data √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj.and.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.and.Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj.or.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.or.Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=Mj.xor.data √ √ √ √ √ √ √ √ √ √ √ √ Mi= Mj.xor.Mk √ √ √ √ √ √ √ √ √ √ √ √ Mi=.inv.Mj √ √ √ √ √ √ √ √ √ √ √ √ Mi(j)=1/ 0 √ √ √ √ √ √ √ √ √ √ √ √ P2=Mi/ data √ --- --- --- --- --- --- --- --- --- --- --- P3=Mi/ data --- --- √ √ --- √ √ --- --- --- --- RandN?=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN?=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ RandN:[p_0 x p_1 …] √ √ √ √ √ √ √ √ √ √ √ √ Mi?=data:p_name √ √ √ √ √ √ √ √ √ √ √ √ EM55000/S/L Series IDE User’s Guide --- Processing ESY Programs for EM55000S Series • 111 3 Chapter 7 Mi?=Mj:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi(j)?=1/ 0:p_name √ √ √ √ √ √ √ √ √ √ √ √ Mi?=[d x d x]:[p_0 x p_2…] √ √ √ √ √ √ √ √ √ √ √ √ Mi:[p_0 x p_2...] √ √ √ √ √ √ √ √ √ √ √ √ TRn?=H/ L:p_name √ √ √ √ √ √ √ √ √ √ √ √ PLAY2?:p_name √ √ √ √ √ √ √ √ √ √ √ √ FV_ON=data √ --- √ √ --- √ √ --- √ √ --- FV_OFF √ --- √ √ --- √ √ --- √ √ --- PAUSE2 √ √ √ √ √ √ √ √ √ √ √ √ STOP2 √ √ √ √ √ √ √ √ √ √ √ √ END √ √ √ √ √ √ √ √ √ √ √ √ BK_ENABLE(Name) √ √ --- --- --- √ √ √ √ √ √ √ BK_DISABLE √ √ --- --- --- √ √ √ √ √ √ √ IR_ON --- --- √ √ √ √ √ √ √ √ √ √ IR_OFF --- --- √ √ √ √ √ √ √ √ √ √ Mi=IRRX --- --- √ --- --- √ --- --- √ --- --- --- IRTX=Mi/Data --- --- √ --- --- √ --- --- √ --- --- --- 7.3 Example of EASY Format® (ESY) Program Example : ONE SHOT (Trigger 1) – Retriggerable by itself in EASY-1 Format [InputState] ;Statename: Tr1 STATE0: PATH1 Tr2 X [OutputState] OUT0: P2=[x x 0 x] OUT1: P2=[x x 1 x] [PATH] PATH0: OUT0 STATE0 END PATH1: OUT1 CH2:ONE.WAV OUT0 END 112 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 7.4 Application Circuits 7.4.1 EM55003S Format Maximum Trigger Number I/O Pin Available EASY-1 1 P2.1 EASY-2 2 N/A The application circuits for each format are illustrated below. VCC VCC VCC VDD VO1 VO2 VCC OSC VSSD VSSC TR1 P20 P21 EASY - 1 Application Circuit Figure 7-2a EM55003S EASY-1 Application Circuit VCC VCC VCC VDD VO1 VO2 VCC TR1 OSC VSSD VSSC TR2 P20 P21 EASY - 2 Application Circuit Figure 7-2b EM55003S EASY-2 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 113 3 Chapter 7 7.4.2 EM55005S/7S/9S Format Maximum Trigger Number I/O Pin Available EASY-2 2 P3.2, P.33 EASY-4 4 P3.3 EASY-6 6 N/A The application circuits for each format are illustrated below. VCC VCC SPEAKER VO1 VO2 VCC VDD OSC VSSD VSSC VCC P32 P33 TR1 P21 TR2 P20 EASY - 2 Application Circuit Figure 7-3a EM55005S/7S/9S EASY-2 Application Circuit VCC VCC VCC VDD VO1 VO2 OSC VSSD VSSC P33 P32 P21 P20 VCC TR1 TR2 TR3 TR4 EASY - 4 Application Circuit Figure 7-3b EM55005S/7S/9S EASY-4 Application Circuit 114 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 VCC VCC SPEAKER VCC VDD VO1 VO2 OSC VSSD VSSC P33 P32 P21 P20 VCC TR1 TR2 TR3 TR5 TR4 TR6 EASY - 6 Application Circuit Figure 7-3c EM55005S/7S/9S EASY-6 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 115 3 Chapter 7 7.4.3 EM55012S/15S Format Maximum Trigger Number I/O Pin Available EASY-3 3 P3.1, P3.2, P3.3 EASY-6 6 P3.2, P3.3 EASY-9 9 P3.3 EASY-12 12 N/A The application circuits for each format are illustrated below. VCC VCC SPEAKER VCC VDD VO1 VO2 OSC VSSD VSSC P22 P21 P20 P33 P32 P31 VCC TR1 TR2 TR3 EASY - 3 Application Circuit Figure 7-4a EM55012S/15S EASY-3 Application Circuit VCC VCC SPEAKER VCC VDD VO1 VO2 OSC VSSD VSSC P22 P21 P20 P33 P32 P31 VCC TR1 TR4 TR2 TR5 TR3 TR6 EASY - 6 Application Circuit Figure 7-4b EM55012S/15S EASY-6 Application Circuit 116 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Chapter 7 VCC VCC SPEAKER VCC VDD VO1 VO2 OSC VSSD VSSC P22 P21 P20 P33 P32 P31 VCC TR4 TR7 TR2 TR5 TR8 TR3 TR6 TR9 TR1 EASY - 9 Application Circuit Figure 7-4c EM55012S/15S EASY-9 Application Circuit VCC VCC SPEAKER VCC VDD VO1 VO2 OSC VSSD VSSC P22 P21 P20 P33 P32 P31 VCC TR4 TR7 TR10 TR2 TR5 TR8 TR11 TR3 TR6 TR9 TR12 TR1 EASY - 12 Application Circuit Figure 7-4d EM55012S/15S EASY-12 Application Circuit EM55000/S/L Series IDE User’s Guide Processing ESY Programs for EM55000S Series • 117 3 Chapter 7 118 • Processing ESY Programs for EM55000S Series EM55000/S/L Series IDE User’s Guide Appendix A Appendix A Sleep/Wake-up &Power Consumption of I/O Ports for EM55000/L Series A.1 Introduction EM55000/L provides flexible I/O functions. At power down (sleep) mode the current consumption is less than 1.0 µA at 3V. If I/O pins are not used properly, the standby current consumption will be a lot higher. The following pages describe the I/O pins design, their characteristics, and the areas where attention is required to optimize their working condition. For information on pin assignment and their electrical characteristics, refer to the pertinent IC Product Specification. A.2 I/O Status during Wake Up and Sleep Mode When power is applied to the IC, the initialization sequence that takes 64ms is started. During the initialization period, the IC ignores the changes outside the I/O port. During power down (sleep) mode, if Port 1 or Port 2 (Port 2 only for EM55002/L ~ EM55700/L) is triggered by a qualified rising or falling edge, the IC will wake up and starts to execute the program. This wake up process takes about 1 to 2 ms to complete. If the rising/falling edge triggers while the IC is in the wake up mode, it will not affect the program execution. A.2.1 “KEYB” Instruction with EM55100/L ~ EM55700/L "KEYB" instruction, which is available to EM55100/L ~ EM55700/L; is used to suppress or ignore wake up function on Port 2. That is, when EM55100/L ~ EM55700/L series IC is in power down (Sleep) mode, rising/falling edge trigger on Port 2 is ignored and the IC remains under sleep mode. EM55000/S/L Series IDE User’s Guide Sleep/Wake-up/Power Consumption for EM55000 • 119 3 Appendix A A.2.2 Port 1 Structure There are two pull-down resistors inside Port 1. Their values are 1M and 100k respectively. The structure is as illustrated below: Figure A-1a Port 1 Structure When an "H" occurs, M2 is turned OFF. Due to the presence pull-down resistors in Port 1, the external circuit output impedance should be smaller than 20K in order to fetch a higher signal. Figure A-1b Port 1 Output Impedance External Circuit 120 • Sleep/Wake-up/Power Consumption for EM55000 EM55000/S/L Series IDE User’s Guide Appendix A A.2.3 Port 3 Structure The Port 3 structure as shown below, contains an output circuit that is controlled by two instructions“MOV P3S, A” “MOV P3, A” Figure A-2 Port 3 Structure The result is as follows. EM55000/S/L Series IDE User’s Guide P3S P3 P3.X 1 0 F 1 1 F 0 0 0 0 1 1 Sleep/Wake-up/Power Consumption for EM55000 • 121 3 Appendix A A.2.4 Port 2 Structure The Port 2 structure is the combination of Port 1 and Port 3 structures. During power on, N2 is turned off. The output circuit is formed by N1 and M1. Under this condition, Port 2 behaves like Port 1. When "KEYB" is executed, M1 is turned off, while N1 and N2 make-up the output circuit. At this stage, Port 2 behaves close to the characteristics of Port 3. When high impedance is required by the application circuit, M1 should be selected, as the impedance of N2 is lower. When higher sink current is required, N2 should be selected. Also, P2S can be set as 1 to turn off all output circuits (N1, N2, and M1) of P2.X. Figure A-3 Port 2 Structure 122 • Sleep/Wake-up/Power Consumption for EM55000 EM55000/S/L Series IDE User’s Guide Appendix A A.2.5 Port 3.3 Flash-with-Volume Function P3.3 is a special pin. It is built with a "Flash-with-Volume" function. The following instruction set turns On or Off this special function: “MOV A, #data” (data=1~7) “MOV FMODE, A” (turn On) “MOV A, #0” “MOV FMODE, A” (turn Off) Figure A-4 Port 3.3 Structure A.2.6 FV_ON, FV_OFF, and Output Setting in EASY Format® When “FV_ON=data” instruction is used, the “Flash-with-Volume” function is enabled. Remember to turn off this function (using "FV-OFF" command) before power down. Example 1: PATH1 : FV_ON=data #1 #2 Enable Flashwith-Volume FV_OFF END Disable Flash-withVolume before power down. Play section Example 2: Output setting (take note of the “F” instruction) OUT1 : P3 = [ P+ X F 0 ] Where P3.1 is set as "F"(floating) and at the same time, the external circuit must provide a "0" or "1", and should not let it float for the IC to enter into power down (sleep) mode. EM55000/S/L Series IDE User’s Guide Sleep/Wake-up/Power Consumption for EM55000 • 123 3 Appendix A A.2.7 Mode and Output in Assembly After "Flash-with-Volume" is turned on, the following instructions must be executed before the "END" instruction: "MOV A, #0" "MOV FMODE, A" "END" (turn off this Flash function) (then power down) If P2S or P3S is set as "1", the external application circuit should not be floating. Example: "MOV A, #0100B" "MOV P3S, A" (P3.2 floating) The above instruction will set Pin P3.2 into floating condition. Under this condition, the external circuitry should provide a logic "0" or "1" before power down (preferably at "0" level). If the external application circuit does not provide "1" or "0" and enters into power down (sleep) state, higher standby current will occur. A.2.8 External Circuit for Port 1 Due to the presence of a built in pull down resistor at Port 1, the external application circuit should be floating or at "0" state before going into power down mode. 124 • Sleep/Wake-up/Power Consumption for EM55000 EM55000/S/L Series IDE User’s Guide Appendix B Appendix B Sleep/Wake-up & Power Consumption of I/O Ports for EM55000S Series B.1 Introduction EM55001S provides flexible I/O functions. At power down (sleep) mode the current consumption is less than 1.0 µA at 3V. If I/O pins are not used properly, the standby current consumption will be a lot higher. The following pages describe the I/O pins design, their characteristics, and the areas where attention is required to optimize their working condition. For information on pin assignment and their electrical characteristics, refer to the pertinent IC Product Specification. B.2 I/O Status during Wake Up and Sleep Mode When power is applied to the IC, the initialization sequence that takes 64ms is started. During the initialization period, the IC ignores the changes outside the I/O port. During power down (sleep) mode, if Port 2 is triggered by a qualified rising or falling edge, the IC will wake up and starts to execute the program. This wake up process takes about 1 to 2 ms to complete. If the rising/falling edge triggers while the IC is in wake up mode, it will not affect the program execution. B.2.1 Port 2 Structure The output circuit of P2 is made-up of P1, N1, N2, and N3. During power on, all MOS of P2 are turned off. When P2S sets to high, all MOS of the corresponding pin will also be off. NOTE This is unlike EM55000 and EM58000 series where, when P2S sets to high, N3 remains active. EM55000/S/L Series IDE User’s Guide Sleep/Wake-up/Power Consumption for EM55000S • 125 3 Appendix B Figure B-1 Port 2 Structure P1 PMOS Drive current : 2mA @Vcc=3 volt ,Vo=2.4 volt N1 NMOS Sink current : 2.3mA @Vcc=3 volt, V0=0.4 volt N2 NMOS Resistance: about 1MΩ N3 NMOS Resistance: about 100kΩ B.2.1.1 Port 2.0 Behavior - No NMOS1 Item Flash P2S P2 PMOS1 NMOS1 NMOS2 NMOS3 Wake up 1 x 0 0 OFF -------- ON Active Yes 2 x 0 1 ON -------- OFF OFF Yes 3 x 1 x OFF -------- OFF OFF Yes Application Wake up function always enabled P2.0 is not suitable for output low to sink LED PMOS 1 can be used to drive LED if necessary Active for NMOS3 means; if pin is connected to high, NMOS3 is off. If connected to low, NMOS3 is on B.2.1.2 Port 2.1 Behavior - With NMOS1 Item Flash P2S P2 PMOS1 NMOS1 NMOS2 NMOS3 Wake up 1 1 x x OFF Active OFF OFF No 2 0 0 0 OFF OFF ON Active Yes 3 0 0 1 ON OFF OFF OFF Yes 4 0 1 x OFF OFF OFF OFF Yes Application Wake up function is allowed when flash-with-volume feature is not active. When Flash-with-Volume is activated, Port 2.1 wake up function is disabled. NMOS 1 is only active when under Flash-with-Volume. Under other condition, it is turned off. You can use Flash-with-Volume mode to connect LED. PMOS 1 can be used to drive LED if necessary. 126 • Sleep/Wake-up/Power Consumption for EM55000S EM55000/S/L Series IDE User’s Guide Appendix B B.2.2 Port 2.1 Flash-with-Volume Function P2.1 is a special pin. It is built with a "Flash-with-Volume" function. The following instruction set turns On or Off this special function: “MOV A, #data” “MOV FMODE, A” “MOV A, #0” “MOV FMODE, A” (data=1~7) (turn On) (turn Off) Figure B-2 Port 2.1 Structure B.2.3 FV_ON, FV_OFF, and Output Setting in EASY Format® When “FV_ON=data” instruction is used, the “Flash-with-Volume” function is enabled. Remember to turn off this function (using "FV-OFF" command) before power down. Example 1: PATH1 : FV_ON=data #1 #2 Enable Flashwith-Volume FV_OFF END Disable Flash-withVolume before power down. Play section Example 2: Output setting (take note of the “F” instruction) OUT1 : P2 = [ P+ X F 0 ] Where P2.1 is set as "F"(floating) and at the same time, the external circuit must provide a "0" or "1", and should not let it float for the IC to enter into power down (sleep) mode. EM55000/S/L Series IDE User’s Guide Sleep/Wake-up/Power Consumption for EM55000S • 127 3 Appendix B B.2.4 Mode and Output in Assembly After "Flash-with-Volume" is turned on, the following instructions must be executed before the "END" instruction: "MOV "MOV A, FMODE, #0" A" "END" (turn off this Flash function) (then power down) If P2S is set as "1", the external application circuit should not be floating. Example: "MOV A, #0010B" "MOV P2S, A" (P2.1 floating) The above instruction will set Pin P2.1 into the floating condition. Under this condition, the external circuitry should provide logic "0" or "1" before power down (preferably at "0" level) state. Otherwise, higher standby current will occur. 128 • Sleep/Wake-up/Power Consumption for EM55000S EM55000/S/L Series IDE User’s Guide Appendix C Appendix C Infrared Ray (IR) Application Using EASY ® Format NOTE EM55001/L and EM55002/L do not support IR feature under EASY Format® C.1 IR Description for EM55100/L ~ EM55700/L and EM55005S ~ EM55015S Series If the EM55100/L ~ EM55700/L or EM55005S ~ EM55015S Series are set up for IR mode, Pin P3.2 will generate 38KHz square wave. The IR receiver pin for EASY format® of the chips varies according to chip types or as shown in the following table (also refer to application circuits shown in Section C.3 below). Chip Type IR Receiver Pin EM55100/L~EM55700/L P1.3 EM55005S~EM55009S P2.1 EM55012S~EM55015S P2.2 C.2 EASY Program Usage for IR The following shows the IR path equation of EASY program file format. IR_on Define the Pin P3.2 to generate 38KHz square wave. IR_off Define Pin P3.2 to turn off the 38KHz square wave. IRtx=Mi/data Define the content of IR transmission as the content of register “Mi” or data. After the parameter is executed, Pin P3.2 will transmit the IR data. Mi=IRrx Define the content of register “Mi” as the content of received IR data. EM55000/S/L Series IDE User’s Guide Infrared Ray (IR) Application Using EASY FormatP® • 129 3 Appendix C IRTXh3, IRTXh2, IRTXh1, For 16 bits IR transmission, assign transmission data to IRTXh0 =Mi/data IRTXh3, IRTXh2, IRTXh1, and IRTXh0. Execute (for EM55200/L ~ EM55700/L) “IRTX16” command to transmit these IR data. Mi=IRRXh3, IRRXh2, For 16 bits IR receiving, execute “IRRX16” command IRRXh1, IRRXh0 to receive IR data. Use IRRXh3, IRRXh2, IRRXh1, (for EM55200/L ~ EM55700/L) and IRRXh0 to retrieve the received data. IRTX16 For 16 bits IR transmission, this command is used to (for EM55200/L ~ EM55700/L) transmit data stored in IRTXh3, IRTXh2, IRTXh1, and IRTXh0. IRRX16 For 16 bits IR receiving, this command is used to (for EM55200/L ~ EM55700/L) receive IR data. Use IRRXh3, IRRXh2, IRRXh1, and IRRXh0 to retrieve the received data. NOTE 1. Received data maybe any value from 0 to 15. The received data are checked for accuracy. If data is in error, “0” value is returned (i.e., If the received data is “0”, it may be an error data). 2. If EM55100/L ~ EM55700/L use the IR receiver in EASY-n format. The Pin P1.3 is treated as the receiving pin. Trigger paths that connect to the Pin P1.3 must bear the same path names as in trigger state definition. The following shows these trigger paths in EASY-n format. EASY-4 EASY-8 EASY-12 EASY-16 EASY-20 tr4 tr4, tr8 tr4, tr8, tr12 tr4, tr8, tr12, tr16 tr4, tr8, tr12, tr16, tr20 3. If EM55005S ~ EM55009S use the IR receiver in EASY-n format, the Pin P2.1 is treated as the receiving pin. Trigger paths that connect to the Pin P2.1 must bear the same path names as in trigger state definition. The following shows these trigger paths in EASY-n format. EASY-2 EASY-4 EASY-6 tr2 tr2, tr4 tr2, tr4, tr6 4. If EM55012S ~ EM55015S use the IR receiver in EASY-n format, the Pin P2.2 is treated as the receiving pin. Trigger paths that connect to the Pin P2.2 must bear the same path names as in trigger state definition. The following shows these trigger paths in EASY-n format. EASY-3 EASY-6 EASY-9 EASY-12 tr3 tr3, tr6 tr3, tr6, tr9 tr3, tr6, tr9, tr12 5. If EM55100/L ~ EM55700/L uses the IR receiver, the IR receiver path equation will be executed when the IR receiver pin receives the falling pulse in the sleep mode. It is recommended that “Mi=IRrx” is made the first parameter of the IR receiver path equation. 130 • Infrared Ray (IR) Application Using EASY FormatP® EM55000/S/L Series IDS User’s Guide Appendix C The receive and transmit application circuits for IR are as illustrated below. The IR application circuits for EASY-4/8/12/16 are similar to that of EASY-20. It is recommended that an I/O pin be used to control the Vcc pin in the IR receiver module to prevent possible current leakage. NOTE 1, If the IR receiver receives noise signal, the “Mi” value (under “MI=IRrx” parameter) will be “0.” Therefore, avoid setting “Mi” to “0.” 2. In order to prevent current leakage, set Pin P3.2 to “0” when using the npn BJT in the transmit. Likewise, set Pin P3.2 to “1” when using the pnp BJT in the transmit. C.3 IR Application Circuits VCC Q? PNP VCC VCC VDD VO1 VO OSCI Rosc IR LED OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 VCC P23 P22 P21 P20 IR RECEIVER OUT IR application circuit for Easy Figure C-1a IR Application Circuit for EASY EM55000/S/L Series IDE User’s Guide Infrared Ray (IR) Application Using EASY FormatP® • 131 3 Appendix C VCC VCC VDD IR application circuit for Easy-20 VO1 VO OSCI Rosc VCC OSCO TEST P33 P32 VSSD P31 VSSC P30 P13 P12 P11 P10 Q? PNP IR LED P23 P22 P21 P20 VCC TR1 TR5 TR9 TR13 TR17 TR2 TR6 TR10 TR14 TR18 TR3 TR7 TR11 TR15 TR19 VCC IR RECEIVER OUT Figure C-1b IR Application Circuit for EASY-20 C.4 Examples of IR Applications in EASY Format® (ESY) Program The following examples demonstrate the IR application in EASY Format® programming. Comments of the program are prefixed with a semi=colon (;). Example 1: IR Program in EASY Format® [InputState] ;Statename: P1.0 P1.1 P1.2 P1.3 P2.0 P2.1 P2.2 P2.3 P3.0 P3.1 P3.2 P3.3 STATE0: X X X /Rx X X X X X X 1 Tx [OutputState] [Path] PATH0: CH1:FREQ=8K STATE0 END Tx: M1=1 IRtx=M1 PATH0 Rx: M13=IRrx M13?=1:P0 PATH0 P0: CH1:1.WAV PATH0 [Background] [ASM] 132 • Infrared Ray (IR) Application Using EASY FormatP® EM55000/S/L Series IDS User’s Guide Appendix C Example 2: IR Program in EASY-20 Format The following example uses the Pin P3.3 to control the Vcc of IR receiver. [InputState] ;Statename: tr1 tr2 tr3 tr4 tr5 tr6 tr7 tr8 tr9 tr10 tr11 tr12 tr13 tr14 tr15 tr16 tr17 tr18 ; tr19 tr20 STATE0: tr1 tr2 tr3 /rx tr5 tr6 tr7 /rx tr9 tr10 tr11 /rx tr13 tr14 tr15 /rx tr17 tr18 & tr19 /rx [OutputState] Out:p3=[1 1 0 0] [Path] PATH0: out ch1:freq=8k STATE0 END tr1: m4=1 IRtx=m4 PATH0 tr2: IRtx=2 PATH0 tr3: m1=3 IRtx=m1 PATH0 tr5: IRtx=5 PATH0 ………………… rx: m13=IRrx p3=#0000b m13:[x p1 p2 p3 ….p15] PATH0 p1: ch1:1.wav PATH0 p2: ch1:2.wav PATH0 [Background] [ASM] EM55000/S/L Series IDE User’s Guide Infrared Ray (IR) Application Using EASY FormatP® • 133 3 Appendix C Example 3: 16-bits IR Program in EASY-20 Format The following example uses the Pin P3.3 to control the Vcc of IR receiver. [InputState] ;Statename: tr1 tr2 tr3 tr4 tr5 tr6 tr7 tr8 tr9 tr10 tr11 tr12 tr13 tr14 tr15 tr16 tr17 tr18 tr19 tr20 STATE0: tr1 tr2 tr3 /rx tr5 tr6 tr7 /rx tr9 tr10 tr11 /rx tr13 tr14 tr15 /rx tr17 tr18 tr19 /rx [OutputState] Out:p3=[1 1 0 0] [Path] PATH0: out ch1:freq=8k STATE0 END tr1: m4=1 m5=3 m6=7 m7=9 & IRTXH3=m4 IRTXH2=m5 IRTXH1=m6 IRTXH0=m7 & IRTX16 & END tr2: IRTXH3=2 IRTXH2=4 IRTXH1=6 IRTXH0=8 & IRTX16 & END . . ………………… rx: IRRX16 & m8=IRRXH3 m9=IRRXH2 m10=IRRXH1 m11=IRRXH0 & p3=#0000b m13= m8 m13:[x w1 w2 w3 ….w15] PATH0 ;//assign transmission data ;//transmit IR data ;//assign transmission data ;//transmit IR data ;//receive IR data ;//retrieve receive data w1: ch1:1.wav PATH0 w2: ch1:2.wav PATH0 …………………… [Background] [ASM] 134 • Infrared Ray (IR) Application Using EASY FormatP® EM55000/S/L Series IDS User’s Guide