Home
356KB - Spansion
Contents
1. 2 52 lt 16 9 APPENDIX qe 17 MCU AN 500038 E 10 Page 3 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 1 Introduction 1 Introduction There are three methods to design a keyboard function using the MB95200 series MCU external interrupt AD and matrix This document describes how to use the matrix method to develop a keyboard function and illustrates the method with an example MCU AN 500038 E 10 Page 4 co Keyboard Development Using Matrix V1 0 Chapter 2 Hardware Design FUJITSU 2 Hardware Design This chapter introduces how to use the matrix method to create a keyboard function with hardware circuit There are two methods to eliminate jittering software method and hardware method To use the hardware method a capacitor should be added to the circuit Figure 2 1 Circuit for Keyboard Design Using Matrix As indicated in the figure above P04 07 are used as output pins and POO as input pins to scan the keyboard status MCU AN 500038 E 10 Page 5 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 3 Keyboard Development 3 Keyboard Development This chapter introduces how to develop the keyboard using matrix 3 1 Function of Matrix Circuit The Keyboard is an important tool f
2. PERFORM The following document contains information on Cypress products Although the document is marked with the name Spansion and Fujitsu the company that originally developed the specification Cypress will continue to offer these products to new and existing customers Continuity of Specifications There is no change to this document as a result of offering the device as a Cypress product Any changes that have been made are the result of normal document improvements and are noted in the document history page where supported Future revisions will occur when appropriate and changes will be noted in a document history page Continuity of Ordering Part Numbers Cypress continues to support existing part numbers To order these products please use only the Ordering Part Numbers listed in this document For More Information Please contact your local sales office for additional information about Cypress products and solutions About Cypress Cypress NASDAQ CY delivers high performance high quality solutions at the heart of today s most advanced embedded systems from automotive industrial and networking platforms to highly interactive consumer and mobile devices With a broad differentiated product portfolio that includes NOR flash memories F RAM and SRAM Traveo microcontrollers the industry s only PSoC programmable system on chip solutions analog and PMIC Power Management ICs CapSense capacitive touch sensing controlle
3. C Fujitsu Semiconductor Shanghai Co LTD Give a example for basic I O matrix include MB95200 IO mb95200 h void timer init void TOODR 0x88 TMCRO 0x10 16 bit TOOCRO 0x81 interval timer with continuous mode TOOCR1 0 0 disable output start timer 0x13 5000us m SCAN void IO restart void PDRO restart PDRO OxFF P04 low void Pin P04 begin to scan PDRO_PO4 0 void Read and store PDRO in value 1 port valuel PDRO Hoa E E key judge port value2 PDRO Read and store PDRO in value 2 if port value2 port valuel switch port value2 case OxEE SW1 case OxED SW2 case OxEB SW3 case 0 7 SW4 H P05 scan void P05_low void Pin P05 begin to PDRO P05 0 MCU AN 500038 E 10 Page 11 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 6 Sample Code void Row two process void key judge port value2 PDRO0 if port value2 port valuel switch port value2 case OxDE SW5 break case OxDD SW6 break case OxDB SW7 break case 0 07 SW8 break POG void P06_low void Pin P06 begin to scan PDRO P06 0 5 void Row three process void key judge port value2 PDRO if port value2 port valuel switch port value2 case OxBE SW9 break case OxBD SW10 break case OxBB SW11 break
4. case 0 7 SW12 break POT scams void P07 low void Pin P07 begin to scan if PDRO P0720 void Row_four_process void key judge port value2 PDRO0 if port value2 port valuel switch port value2 case Ox7E SW13 break case 0x7D SW14 break case 0 7 SW15 break case 0x77 SW16 break MCU AN 500038 E 10 Page 12 co Keyboard Development Using Matrix V1 0 Chapter 6 Sample Code FUJITSU void SW1 void Key Process void SW16 void if ESTE void Timer Interrupt void key scan process TOOCR1_IF 0 timer_counter if timer_counter 0 PDRO restart IO restart 04 begin to scan 04 low TETTE Read and store P Port Valuel i e e 9 Read and store PDRO and judge keypressed Row one process PDRO restart IO restart EET P05 begin to scan P05 low dM Read and store P Port Valuel EET Read and store PDRO and judge keypressed Row two process ET PDRO restart IO restart er er P06 begin to scan P06 low UR TE Read and store PDRO Port Valuel MCU AN 500038 E 10 Page 13 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 6 Sample Code if timer counter 29 Read and store PDRO and judge keypressed Row three process E PDRO restart i IO restart p E P07 begin to scan PO7 low Read and store P Port
5. 38 E 10 Page 16 co Keyboard Development Using Matrix V1 0 J Chapter 9 Appendix FU ITSU 9 Appendix Figure 2 1 Circuit for Keyboard Design Using 5 Figure 3 1 Timing Chart for Jittering 6 Figure 5 1 Flow Chart of Keyboard Development by Matrix 10 MCU AN 500038 E 10 Page 17
6. Fujitsu Semiconductor Shanghai Co Ltd MCU AN 500038 E 10 Application Note F2MC 8FX FAMILY 8 BIT MICROCONTROLLER MB95200 SERIES KEYBOARD DEVELOPMENT USING MATRIX APPLICATION NOTE co FUJITSU FUJITSU Keyboard Development Using Matrix V1 0 Revision History Revision History Version Date Updated by Modifications 1 0 3 5 2009 Benjamin Yang First draft This manual contains 17 pages 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 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 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 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 permiss
7. Valuel 32 Read and store PDRO and judge keypressed ji Row four process lene PDRO restart IO restart 227 Timer counter restart timer counter 0 void clock Select void SYCC 0x00 WATR 0x00 STBC 0x01 SYCC2 0xF4 void main void InitIrqLevels Meng timer counter 0 DDRO 0 0 P00 P03 in P04 P07 out AIDRL OxFF Port input enable clock Select Main clock select timer init Timer initialize while 1 MCU AN 500038 E 10 Page 14 co Keyboard Development Using Matrix V1 0 FUJITSU Chapter 7 Performance Evaluation 7 Performance Evaluation To eliminate jittering there are hardware method and software method Though the code of hardware method is very simple only using the timer calculagraph its effect is not good because the system may not be able to scan the edge By comparison the software method is better MCU AN 500038 E 10 Page 15 co FUJITSU Keyboard Development Using Matrix V1 0 Chapter 8 Additional Information 8 Additional Information For more information about how to use MB9595200H 210H EV board BGM Adaptor and SOFTUNE please refer to SKT MB2146 410A 01 E User Manual or visit 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 5000
8. e and i i Read PDRO value and store in value1 store in value1 Timer time 20ms Timer time 20ms Read PDRO value and Read PDRO value and store in value2 store in value2 Compare value and value 2 Compare value1 and value 2 P05 outputs high voltage P04 outputs high voltage PDRO OxFF MCU AN 500038 E 10 Page 9 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 5 Software Design P07 outputs low voltage PDRO 0x7F P06 outputs low voltage PDRO OxBF Timer time 5ms Read PDRO value and store in value1 Read PDRO value and store in value1 Timer time 20ms Read PDRO value and store in value2 Read PDRO value and store in value2 P07 outputs high voltage 06 outputs high voltage PDRO OxFF Figure 5 1 Flow Chart of Keyboard Development by Matrix MCU AN 500038 E 10 Page 10 co Keyboard Development Using Matrix V1 0 Chapter 6 Sample Code FUJITSU 6 Sample Code This chapter illustrates keyboard development using Matrix Based on MB2146 410 01 the following code is intended to illustrate how to create a keyboard function with I O port Port 0 is used for detecting key status The default level of input is high THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS FUJITSU SEMICONDUCTOR ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR ELIGIBILITY FOR ANY PURPOSI
9. ion as defined under the law 2009 Fujitsu Semiconductor Shanghai Co Ltd MCU AN 500038 E 10 Page 2 co Keyboard Development Using Matrix V1 0 J Contents FU ITSU CONTENTS REVISION HISTORY er Dm 2 CONTENTS U 3 UM ias ic TTT T 4 2 HARDWARE DESIGN ie ust den eani ane 5 3 KEYBOARD DEVELOPMENT ee san 6 3 1 Function of Mat Seer ne 6 32 dieng SINI NON PEU Rm 6 3 3 Jittering Elimination Example DUE 6 4 7 4 1 Register INTOd CtUON m 7 4 1 1 Port Data Register PD ind okt ebi tesa sin ma quet pn piti Bass Ent tta 7 4 1 2 Data Direction Register DDR oo oo oom 7 4 1 3 Pull up Control Register PUL Woo 7 4 1 4 Input Level Selection Register ILSR ooooooooooWoW oom Wo 7 4 2 General 8 4 2 1 How to Set Input PIN 8 4 2 2 Howto Set 8 4 2 3 Pull up Egi Sen eem 8 5 SOFTWARE DESIGN 9 921 SoftWare Desig TREE 9 SAMPLE CODE C 11 7 PERFORMANCE EVALUATION nenne onera tnra e nonna nan tnnc o aant nan uUn anus e cena nuance 15 8 ADDITIONAL
10. nd prevention of over current levels and other abnormal operating conditions If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan the US Export Administration Regulations or the applicable laws of any other country the prior authorization by the respective government entity will be required for export of those products Trademarks and Notice The contents of this document are subject to change without notice This document may contain information on a Spansion product under development by Spansion Spansion reserves the right to change or discontinue work on any product without notice The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy completeness operability fitness for particular purpose merchantability non infringement of third party rights or any other warranty express implied or statutory Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document Copyright O 2013 Spansion Inc All rights reserved Spansion the Spansion logo MirrorBit MirrorBit Eclipse ORNAND and combinations thereof are trademarks and registered trademarks of Spansion LLC in the United States and other countries Other names used are for informational purposes only and may be trademarks of their respective owners
11. or the input system This reference design is used to show how to save pins when adopting keyboard with many keystrokes A real time monitoring method for polling the keyboard status is also used The period of polling is a fixed value It means any movement slower than this value will be caught by the monitoring software It will ensure the high responding action of the keyboard 3 2 Jittering Elimination Jittering elimination is a problem for keyboard design There are two methods to resolve this problem One is to add a capacitor to the hardware circuit The other is to design a delay by using the 8 16 bit composite timer 3 3 Jittering Elimination Example The timing chart below is an example of jittering elimination This example is a 4x4 keyboard designed by matrix X1 X2 and takes turns to scan the keyboard for about 50 ms each So it takes about 200 ms to scan the whole keyboard DRead 00 value and save into value1 Read 00 value again and save into value2 then compare for filtering the noise Figure 3 1 Timing Chart for Jittering Elimination MCU AN 500038 E 10 Page 6 Keyboard Development Using Matrix V1 0 Chapter 4 Resource Usage co FUJITSU 4 Resource Usage This chapter introduces evaluation steps of normal run status To monitor the keyboard status pins are necessary This chapter will introduce the usage of I O port Please refer to Chapter 9 of the MB95200 Series Hard
12. ps output pins and input pins The output pins are used to output high voltage while the input pins are used to scan the keyboard status 4 2 1 How to Set Input Pin If a pin functions as an input port the corresponding bit in the Data Direction Register should be set to 0 To set an externally connected source to high Z state please use an external pull up or pull down resistor or set the corresponding bit in the Pull up Register There are three types of input modes digital input ADC input and peripheral function input Digital input means the port is used as general I O ADC input means the port is used for analog input only Peripheral function input means the port is used by a peripheral function as input such as external interrupt input 4 2 2 How to Set Output Pin There are two kinds of output modes digital output and peripheral function output Digital output means the port is used as general I O Peripheral function output means the port is used for peripheral resource output such as output of 8 16 bit compound timer 4 2 3 Pull up Register The and PG ports when in input mode can enable an internal pull up resistor about 50 KO please see datasheet for the exact value by programming the pull up register 2 2 3 The initial value of 0 disconnects the internal pull up resistor Writing 1 to the corresponding bit in the PULx register enables the resistor If the port is used for outpu
13. rs and Wireless BLE Bluetooth Low Energy and USB connectivity solutions Cypress is committed to providing its customers worldwide with consistent innovation best in class support and exceptional system value NN SPANSION a Colophon The products described in this document are designed developed and manufactured as contemplated for general use including without limitation ordinary industrial use general office use personal use and household use but are not designed developed and manufactured as contemplated 1 for any use that includes fatal risks or dangers that unless extremely high safety is secured could have a serious effect to the public and could lead directly to death personal injury severe physical damage or other loss i e nuclear reaction control in nuclear facility aircraft flight control air traffic control mass transport control medical life support system missile launch control in weapon system or 2 for any use where chance of failure is intolerable i e submersible repeater and artificial satellite Please note that Spansion will not be liable to you and or any third party for any claims or damages arising in connection with above mentioned uses of the products Any semiconductor devices have an inherent chance of failure You must protect against injury damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy fire protection a
14. t the value of the register bit has no meaning and the pull up resistor is disabled Exception For I2C pins SDA and SCL the setting remains Also for UART output SOT the internal pull up can be used if not provided by line driver The pull up resistor is disabled when the microcontroller is in stop or timer mode The resistor is also disabled if the pin is used for ADC input If an external pin is used by the external bus interface the internal pull up register cannot be used MCU AN 500038 E 10 Page 8 Keyboard Development Using Matrix V1 0 Chapter 5 Software Design FUJITSU 5 Software Design This chapter describes how to develop a keyboard by matrix 5 1 Software Design To realize this function first initialize the register and setup the AD input forbid then enable the timer interrupts to eliminate jittering The output I O pin outputs high voltage and MCU waits for the input signal Refer for to the hardware circuit if some keys pressed the MCU will scan this information and transact the corresponding key function The flow chart is illustrated as below s Clear timer reload i overflow flag Initialize Main Clock i init and set as input pin 4 07 as output pin Timer time 20ms P05 outputs low voltage P04 outputs low voltage PDRO 0xDF Initialize Timer 0 i TOOCR1 IF PDRO 0 Timer time 5ms Timer time be Read PDRO valu
15. ware Manual for detailed register setting 4 1 Register Introduction 4 1 1 Port Data Register PDR This register contains bit information of corresponding input or output pins The values are output if the Port Direction Register is set to output mode Please note that the resource output control bit overwrites the PDR bit value PDRx yz Pin Function 0 Pin state low VSS 1 Pin state high VDD 4 1 2 Data Direction Register DDR This register contains the bit information of the corresponding pins if they act as input or output DDRx yz Peripheral Function Output Pin Function 0 Disable Port Input 1 Disable Port Output invalid Enable Peripheral Function Output 4 1 3 Pull up Control Register PUL This register connects an internal pull up resistor to a port pin PULx yz Pull up Resistor 0 Disable 1 Enable Please see datasheet for the resistor value 4 1 4 Input Level Selection Register ILSR With this register one of the following input levels can be chosen ILSR Input Level VIL V 0x04 CMOS 0 3 VCC 0 7 VCC 0x00 Hysteresis 0 3 VCC 0 7 VCC Please note that this function is available only in PDRO P04 MCU AN 500038 E 10 Page 7 FUJITSU Keyboard Development Using Matrix V1 0 Chapter 4 Resource Usage 4 2 General Introduction pins which are necessary in this system can be classified into two grou
Download Pdf Manuals
Related Search
Related Contents
Tomacorriente Móvil de 1200 Vatios 1200 Watt Mobile Power YAGー CニS/關 - digital Moteurs Diesel refroidis par air 2-1. 4-Wege-Kassetten-Modell Maytag MED5707TQ1 User's Manual Bedienungsanleitung Bolzenschweißer BMS-10N - soyer USER MANUAL - Icare Finland Scarica le istruzioni PDF Mode d`emploi du site de l`Assainissement et de la Copyright © All rights reserved.
Failed to retrieve file