KEYBOARD DEVELOPMENT USING EXTERNAL INTERRUPT

Similar documents
KEYBOARD DEVELOPMENT USING MATRIX

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

OPERATIONAL AMPLIFIER

OPERATIONAL AMPLIFIER

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

F²MC-8FX FAMILY MB95200H/210H SERIES FLASH MEMORY WITH SECRUITY 8-BIT MICROCONTROLLER APPLICATION NOTE

HOW TO MAKE PRPGRAMMING ON TARGET BOARD

GSM FUNCTION APPLIED IN WIRELESS SOLUTION

F 2 MC-8FX FAMILY MB95200 SERIES 8-BITMICROCONTROLLER. Electronic Safe Door Demo Reference Solution APPLICATION NOTE

TOUCH SENSOR IC ATA2508 DEMONSTRATION SET

F²MC-8FX FAMILY 8-BIT MICROCONTROLLER MB95200H SERIES SPI SW REALIZATION USING GPIO APPLICATION NOTE

F²MC-8FX FAMILY MB95200H/210H SERIES SOP8/SOP16/SOP20 PGM ADAPTOR 8-BIT MICROCONTROLLER APPLICATION NOTE

F2MC-8FX EEPROM LIBRARY

F²MC-8FX FAMILY MB95F310 SERIES. Parallel Programming Reference Solution 8-BIT MICROCONTROLLER APPLICATION NOTE

F2MC-8FX EEPROM Library

F²MC-8FX FAMILY MB95F430 SERIES INDUCTION HEATER HARDWARE 8-BIT MICROCONTROLLER USER MANUAL

F²MC-16FX FAMILY MB96340 KEY MATRIX INTERFACE USING I/O PORT 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

INDUCTOR HEATER (HALF BRIDGE) SOFTWARE

Fujitsu Semiconductor (Shanghai) Co., Ltd. F²MC-8FX FAMILY MB95200H/210H SERIES BASIC FW SETUP

F²MC-8FX Family MB95200H/210H Series Capacitance Touch Sensor

IC CARD AND ESAM OPERATION

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 REAL TIME CLOCK APPLICATION NOTE

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 F²MC-FR FAMILY 32-BIT MICROCONTROLLER MB91460 RELOAD TIMER APPLICATION NOTE

STAND-ALONE PROGRAMMER

STARTER KIT MB E

Interrupt Level Setting and Modification by Interrupt Controller

F²MC-8FX FAMILY MB95200H/210H SERIES LIN-UART 8-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics (Shanghai) Co., Ltd.

ONE PHASE POWER METER (RN8209) SOLUTION

F²MC-8FX FAMILY MB95F370 SERIES ZIGBEE SOLUTION DEVELOPMENT GUI 8-BIT MICROCONTROLLER USER MANUAL

PPG Function of F2MC-16LX MCU Series as PWM

The following document contains information on Cypress products.

MB9AA30N SERIES BLUEMOON-EVB_LCD 32-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Semiconductor Design (Chengdu) Co., Ltd.

F²MC-16LX FAMILY MB90XXX RELOCATED INTERRUPT VECTOR TABLE 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

F²MC-8FX FAMILY MB95200 SERIES EASY KIT FMCDC-MB95260H-EK-01 8-BIT MICROCONTROLLER SETUP GUIDE FUJITSU MICROELECTRONICS SUPPORT SYSTEM

This application note describes the time measurement function of Timer S with the gate function.

UnRegistered MB39C602 LED LIGHTING SYSTEM BULB 9W ZIGBEE CONTROL USER MANUAL. Fujitsu Semiconductor Design (Chengdu) Co. Ltd.

F²MC-16FX FAMILY ALL SERIES STANDBY MODES & POWER MANAGEMENT 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

F 2 MC FAMILY 10BASE-T LAN ADAPTER MB

F 2 MC-8FX Family 8-bit MICROCONTROLLER MB95200H/210H Series STARTER KIT MB A-01-E SETUP GUIDE

EV BOARD MB E

SOFTUNE WORKBENCH MONITOR DEBUGGER FOR 8FX

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 EDSU/MPU APPLICATION NOTE

The following document contains information on Cypress products.

MB39C602 LED LIGHTING SYSTEM BULB 9W ZIGBEE CONTROL

M16C/62 APPLICATION NOTE. Using the M16C/62 DMAC in Forward Source Mode. 1.0 Abstract. 2.0 Introduction

F²MC-16 FAMILY 16-BIT MICROCONTROLLER An Additional Manual for the Softune Linkage Kit

ETHERNET_FLASH_LOADER

CRC GENERATION AND CHECK

M16C/26 APPLICATION NOTE. Using the DMAC with a Forward Source. 1.0 Abstract. 2.0 Introduction

LAMP CONTROL AND MONITOR WITH PPG AND ADC

FR FAMILY FR60 FAMILY ISR DOUBLE EXECUTION 32-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

M16C/Tiny Series APPLICATION NOTE. Operation of Timer A. (2-Phase Pulse Signal Process in Event Counter Mode, Multiply-by-4 Mode) 1.

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

SPI COMMUNICATION TO/FROM SERIAL EEPROM

ONE PHASE POWER METER (CS5464) SOLUTION

M16C/26 APPLICATION NOTE. Using Timer B in Pulse Period/Width Measurement Mode. 1.0 Abstract. 2.0 Introduction

AN10184 Connecting a keyboard to the Philips LPC9xx microcontroller

In repeat transfer mode of DMAC, choose functions from those listed in Table 1. Operations of the checked items are described below.

M32C/84, 85, 86, 87, 88 Group

New 8FX MB95560H/570H/580H Series

M16C/26 APPLICATION NOTE. Implementing Real Time Clock and WAIT Mode. 1.0 Abstract. 2.0 Introduction. 3.0 Real-Time Clock Setup and Implementation

SH7144/45 Group APPLICATION NOTE. 2-Phase Encoder Count. 1. Specifications

Old Company Name in Catalogs and Other Documents

Fujitsu Microelectronics Europe User Guide FMEMCU-SG MB88121 SERIES MB91460 SERIES EVALUATION BOARD SK-91F467-FLEXRAY SOFTWARE GUIDE

CM E FUJITSU SEMICONDUCTOR CONTROLLER MANUAL F 2 MC-16L/16LX EMULATION POD MB HARDWARE MANUAL

EMULATOR SETUP MB BIT COMPACT-ICE

H8SX Family APPLICATION NOTE. Vector Table Address Switching. Introduction. Target Devices. Contents

For More Information Please contact your local sales office for additional information about Cypress products and solutions.

DSU-FR EMULATOR LQFP-144P HEADER TYPE 9 MB E OPERATION MANUAL

This function allows the user to erase any Flash block within the MCU including the near area memory (below address 0xFFFF).

The following article introduces and shows an example of how to set up and use the watchdog timer on the M16C/26 microcontroller (MCU).

FUJITSU SEMICONDUCTOR SUPPORT SYSTEM SS E DSU-FR EMULATOR LQFP-144P HEADER TYPE 4 MB OPERATION MANUAL

M16C R8C FoUSB/UART Debugger. User Manual REJ10J

Module Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events.

Nano102/112 Series Errata Sheet

M3H Group(2) Application Note Asynchronous Serial Communication Circuit (UART-C)

Corporate names revised in the documents

M16C/62 APPLICATION NOTE. Using the Expanded Memory Mode with the M16C/ Abstract. 2.0 Introduction. 3.0 Memory Expansion Mode

1. Specifications Functions Used Operation Software Flowcharts Program Listing... 13

M16C/26 APPLICATION NOTE. Measuring Computation Time of a Function Call. 1.0 Abstract. 2.0 Introduction. 3.0 Number of Function Call Returns

Operation of Timer A (2-phase pulse signal process in event counter mode, multiply-by-4 processing operation)

AN F²MC-16FX Family, I2C. Contents. 1 Introduction. This application note describes how to communicate via I2C with a Serial EEPROM.

M16C/26 APPLICATION NOTE. Interfacing with 1-Wire Devices. 1.0 Abstract. 2.0 Introduction Wire Interface. 3.1 Hardware

Chapter 9 Interrupt Controller

In timer mode, choose functions from those listed in Table 1. Operations of the circled items are described below.

Timer 32. Last updated 8/7/18

F²MC-16FX FAMILY ALL SERIES FLASH SECURITY 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

Introduction to Embedded Systems

F²MC-16LX FAMILY MB90F897 DUAL OPERATION FLASH 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

M3H Group(2) Application Note 12-bit Analog to Digital Converter (ADC-A)

M16C/26 APPLICATION NOTE. Using the M16C/26 Timer in Event Counter Mode. 1.0 Abstract. 2.0 Introduction

MSM GENERAL DESCRIPTION FEATURES. Single Rail CODEC

F 2 MC-8FX Family. 8-bit Microcontroller. MB95200 Series

Audio digital potentiometers

Flash Self-programming Library

EV BOARD MB E

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts

S1C17 Family EEPROM Emulation Library Manual

Semiconductor June 1992

The following article describes how to use the M16C/62 timers A s as square wave generators (Pulse Output Mode).

Transcription:

Fujitsu Semiconductor (Shanghai) Co., Ltd. Application Note MCU-AN-500036-E-10 F²MC-8FX FAMILY 8-BIT MICROCONTROLLER MB95200 SERIES KEYBOARD DEVELOPMENT USING EXTERNAL INTERRUPT APPLICATION NOTE

Revision History Revision History Version Date Updated by Modifications 1.0. 2/16/2009 Benjamin. Yang First draft This manual contains 14 pages. 1. The products described in this manual and the specifications thereof may be changed without prior notice. To obtain up-to-date information and/or specifications, contact your Fujitsu sales representative or Fujitsu authorized dealer. 2. Fujitsu will not be liable for infringement of copyright, industrial property right, or other rights of a third party caused by the use of information or drawings described in this manual. 3. The contents of this manual may not be transferred or copied without the express permission of Fujitsu. 4. The products contained in this document are not intended for use with equipment which require extremely high reliability such as aerospace equipment, undersea repeaters, nuclear control systems or medical equipment for life support. 5. Some of the products described in this manual may be strategic materials (or special technology) as defined by the Foreign Exchange and Foreign Trade Control Law. In such cases, the products or portions theory must not be exported without permission as defined under the law. 2009 Fujitsu Semiconductor (Shanghai) Co., Ltd. MCU-AN-500036-E-10 Page 2

Contents CONTENTS REVISION HISTORY... 2 CONTENTS... 2 1 INTRODUCTION... 4 2 KEYBOARD DEVELOPMENT... 5 2.1 Function of External Interrupt Circuit... 5 2.2 Jittering Elimination... 5 3 HARDWARE DESIGN... 6 3.1 Hardware Modification... 6 4 RESOURCE USAGE... 7 4.1 External Interrupt Control Register (EICxy)... 7 4.2 Interrupt Level Setting Registers (ILR0 to ILR5)... 7 5 SOFTWARE DESIGN... 9 5.1 Software Design by Using External Interrupt... 9 6 SAMPLE CODE... 10 7 PERFORMANCE EVALUATION... 12 8 ADDITIONAL INFORMATION... 13 9 APPENDIX... 14 9.1 Tables... 14 9.2 Figures... 14 MCU-AN-500036-E-10 Page 3

Chapter 1 Introduction 1 Introduction There are three methods to design a keyboard with the MB95200 series MCU. (External interrupt/ad/matrix) This document describes how to design a keyboard with the external interrupt. This document also illustrates the theories of external interrupt with example. MCU-AN-500036-E-10 Page 4

Chapter 2 Keyboard Development 2 Keyboard Development This chapter introduces the Function of using external interrupt to realize the keyboard. 2.1 Function of External Interrupt Circuit The external interrupt circuit is used to detect the edge of a signal inputted to an external interrupt pin and generate an interrupt request to the interrupt controller. As an interrupt wakes up the microcontroller from standby mode to return to its normal operation state, the operation mode can be changed by inputting a signal to the external interrupt pin. 2.2 Jittering Elimination Jittering elimination is a problem in keyboard design. There are two methods to solve this problem. One is to add a capacitor in the hardware circuit and the other is to create a delay by using the 8/16-bit composite timer. MCU-AN-500036-E-10 Page 5

Chapter 3 Hardware Design 3 Hardware Design This chapter introduces the hardware circuit to design keyboard by using External Interrupt. 3.1 Hardware Modification The hardware circuit for jittering elimination is different and needs modification. To eliminate jittering by hardware, a capacitor is needed in the hardware circuit. Figure 3-1: SOFTUNE Version MCU-AN-500036-E-10 Page 6

Chapter 4 Resource Usage 4 Resource Usage This chapter introduces evaluation steps in normal operation mode. For more on register setting, please refer to Chapter 15 of the MB95200 Series Hardware Manual. 4.1 External Interrupt Control Register (EICxy) The external interrupt control register is used to control interrupt and select the edge polarity for the external interrupt input and control interrupts. Table 4-1: External Interrupt Control Register bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Corresponding Ext. Int. No. EIC10 EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0 INT03 INT02 EIC20 EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0 INT05 INT04 EIC30 EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0 INT07 INT06 4.2 Interrupt Level Setting Registers (ILR0 to ILR5) Table 4-2: Configuration of External Interrupt Level Setting Registers ILR0 L03 [1:0] L02 [1:0] L01 [1:0] L00 [1:0] ILR1 L07 [1:0] L06 [1:0] L05 [1:0] L04 [1:0] ILR2 L11 [1:0] L10 [1:0] L09 [1:0] L08 [1:0] ILR3 L15 [1:0] L14 [1:0] L13 [1:0] L012 [1:0] ILR4 L19 [1:0] L18 [1:0] L17 [1:0] L016 [1:0] ILR5 L23 [1:0] L22 [1:0] L21 [1:0] L020 [1:0] One of the interrupt level setting registers (ILR0) contains 4 pairs of bits assigned to interrupt requests from external interrupt. Interrupt Request No. Table 4-3: Interrupt Sources Bit name in Interrupt Level Setting Register Interrupt Source IRQ0 L00[1:0] External Interrupt ch.4 IRQ1 L01[1:0] External Interrupt ch.5 IRQ2 L02[1:0] External Interrupt ch.2/ ch.6 IRQ3 L03[1:0] External Interrupt ch.3/ch.7 MCU-AN-500036-E-10 Page 7

Chapter 4 Resource Usage Each pair of bits (interrupt level setting bits as two-bit data) sets an interrupt level. Table 4-4: Relationships between Interrupt Level Setting Bits and Interrupts Levels LXX[1:0] Interrupt Level Priority 00 0 Highest 01 1 10 2 11 3 Lowest (No interrupts accepted) XX: 00 to 03 Corresponding interrupt number During execution of a main program, the interrupt level bits in the condition code register (CCR: IL1, IL0) usually indicate 11B. MCU-AN-500036-E-10 Page 8

Chapter 5 Software Design 5 Software Design This chapter introduces the keyboard design by using external interrupt. 5.1 Software Design by Using External Interrupt Before perform this function, first initialize the register of the external interrupt, set up interrupt levels, and then enable external interrupt. If a signal is detected, the system will activate the external interrupt function, waiting for about 20ms~100ms to see if the signal is noise. The flow chart is as below: Figure 5-1: Flow Chart of Keyboard Design by Using External Interrupt MCU-AN-500036-E-10 Page 9

Chapter 6 Sample Code 6 Sample Code This chapter gives an example, illustrating how to use the external interrupt to perform the keyboard function. The following example shows how to use the external interrupt Channel 6 to perform a keyboard function. This sample code is based on MB2146-410-01. External interrupt channel 6 is used for to detect the key status. The default input level is high. Program enters ISR while generating an Ext Int in Channel 6, clears flag, activates a timer to create a 20ms interval for the jittering elimination, then waits for the next external interrupt signal. /* EI initialize*/ void InitExtInt06 (void) DDR0 &= 0xBF; EIC30 = 0x07; /* Timer Interrupt routine*/ interrupt void Timer_Interrupt (void) if (T00CR1_IE) T00CR1_IE = 0; test02 = PDR0_P06; level_deal(); EIC30_EIE0 = 1; // Clear timer interrupt request flag // Restart External Interrupt ch6 T00CR1_OE = 0; // Disable timer 0 /* System clock select routine*/ void clock_select(void) // Main clock initialize SYCC = 0x00; WATR = 0x00; STBC = 0x01; SYCC2= 0xF4; while(stbc_mrdy); /* Key routine*/ void level_deal(void) if((test01==test02)&&(test02==0)) // P06 input // External Interrupt 6 double edge // & Enable external interrupt output // Judge if key pressed DDR0_P05 = 1; PDR0_P05 = 0; else if((test01==test02)&&(test02==1)) // Judge if key released DDR0_P05 = 1; PDR0_P05 = 1; MCU-AN-500036-E-10 Page 10

Chapter 6 Sample Code /* EI interrupt routine*/ interrupt void ExInt06 (void) if (EIC30_EIR0) EIC30_EIR0 = 0; EIC30_EIE0 = 0; T01DR = 0x4E; T00DR = 0x14; TMCR0 = 0x10; T00CR0 = 0x80; T00CR1 = 0xA0; test01 = PDR0_P06; /* Main Loop */ void main(void) clock_select(); InitExtInt06(); InitIrqLevels(); EI(); while(1); // Clear interrupt request flag // interrupt server routine // set count value (16 bit, 20ms) // 16-bit, no filtering // Interval timer with single mode // Start timer // Read EI level // System Clock select routine // External interrupt routine Please note that the corresponding interrupt vector and level shall be defined in the vector.c module of Fujitsu s standard template project.... void InitIrqLevels(void) ILR0 = 0xCF; //IRQ2: external interrupt ch6 ILR1 = 0xF3; //IRQ5: 8/16-bit timer ch0 (lower)... interrupt void ExInt06 (void); // Prototype interrupt void Timer_Interrupt(void);... #pragma intvect ExInt06 2 // IRQ2: external interrupt ch6 #pragma intvect Timer_Interrupt 5 // IRQ5: 8/16-bit timer ch0 (lower) Refer to Appendix Sample Code for project EI_Basic. MCU-AN-500036-E-10 Page 11

Chapter 7 Performance Evaluation 7 Performance Evaluation As stated before, there are two methods to eliminate jittering, hardware and software. Encoding for the hardware method is very simple, only using the external interrupt, but the jittering elimination process is not good since the system may not be able to scan the edge. By comparison, the software method is more useful. MCU-AN-500036-E-10 Page 12

Chapter 8 Additional Information 8 Additional Information For more Information on FUJITSU MB95200 products, visit the following websites: English version address: http://www.fujitsu.com/cn/fsp/services/mcu/mb95/application_notes.html Chinese version address: http://www.fujitsu.com/cn/fss/services/mcu/mb95/application_notes.html MCU-AN-500036-E-10 Page 13

Chapter 9 Appendix 9 Appendix 9.1 Tables Table 4-1: External Interrupt Control Register... 7 Table 4-2: Configuration of External Interrupt Level Setting Registers... 7 Table 4-3: Interrupt Sources... 7 Table 4-4: Relationships between Interrupt Level Setting Bits and Interrupts Levels... 8 9.2 Figures Figure 3-1: SOFTUNE Version... 6 Figure 5-1: Flow Chart of Keyboard Design by Using External Interrupt... 9 MCU-AN-500036-E-10 Page 14