Home
291KB - Spansion
Contents
1. File name Files of type Source File c asm Cancel Mem Type Automatic v Insertion Folder i2c Source Files Figure 4 2 Second Step of Use 12C Library MCU AN 500052 E 10 Page 9 FUJITSU 120 Library Usage API V1 0 Chapter 4 Usage Demo Third step is using the 20 library for detailed library please refer to Table 2 1 About the initial function it is used in the library internally so user can ignore it If user wants to write data please use Write I2C function Figure 4 3 is an example which writes data 0x25 to EEPROM sub address 0x01 Write i2c 0xa0 0x01 0x25 Datato be wrote Sub address of Slave chip Address of Slave chip Figure 4 3 Example of Writing If user wants to read data from slave device Figure 4 4 is an example which reads data from EEPROM sub address 0x01 Dat Test Read i2c 0xa0 0x01 Sub address of Slave chip Address of Slave chip Data read from slave chip Figure 4 4 Example of Reading MCU AN 500052 E 10 Page 10 120 Library Usage API V1 0 FUJITSU Chapter 4 Usage Demo lt Fourth step is debugging User needs to add debug document Debugging mode includes serial interface USB interface and LAN interface Figure 4 5 is an example for creating serial interface debug document D Workspace i2c i2c abs i2c prj a Source Files D f2mc8fx c 0 12c e E nain c START ASM
2. vectors c Include Files Dependencies Create Hew setup Setup Name ht laca Gem SL ECCE Reference emulate i2c Seca Property Figure 4 5 Step of Setting Debug Environment For detailed debug information please refer to Chapter 5 MCU AN 500052 E 10 Page 11 FUJITSU 120 Library Usage API V1 0 Chapter 4 Usage Demo 4 2 Software Usage Attention 4 3 When writing data to slave device if the slave device didn t generate acknowledge sign to master the following items may cause it The connect of 12C is not steady The power of slave chip maybe not normal I2C is not initialized I2C bus is busy Shift frequency clock is not suitable for slave chip Sequence of Data Transfer When transmitting the MSB bit is transmitted first MCU AN 500052 E 10 Page 12 120 Library Usage API V1 0 FUJITSU Chapter 5 Debugging 5 Debugging This chapter describes how to debug the sample code l2C prj on start kit and what will happen when the code is running Attachment is the sample project I2C prj This project is based on our start kit MB2146 450 E and the target MCU is MB95F310 For detailed information you can access our website or contact with our sales window person When debugging user must connect slave device and master chip by 12C Figure 5 1 describes the connecting Figure 5 1 Hardware Description The value of pull up resister R
3. 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 sen
4. API V1 0 Chapter 2 I2C Library Function List FUJITSU 2 12C Library Function List This chapter introduces all functions in 12C library in project Simulate LCD EVBoard prj which uses MB95F310 as MCU Table 2 1 lists the 12C functions Table 2 1 12C Functions Function name Description void initial I2C void Initializes I2C and sets shift clock frequency void Write I2C unsigned char addr unsigned char subadd unsigned char data Writes gata to slave Chip unsigned char Read l2C unsigned char addr unsigned char subaddr Reads data from slave chip MCU AN 500052 E 10 Page 5 FUJITSU 120 Library Usage API V1 0 Chapter 3 I2C Function Detail 3 2C Function Detail This chapter introduces the detail of 12C functions 3 1 Initial I2C Function Table 3 1 describes initial I2C function Table 3 1 AD Init Function Function name initial I2C Function prototype void initial I2C void Behavior description Initializes I2C and sets shift clock frequency Input parameter None Return value None Example Sets shift clock frequency to 23KHz when MCLK is 6MHz initial I2C This function is to initialize 12C In this function default shift clock frequency is 23K when MCLK is 6MHz and it can be decided by setting register ICCR The shift clock frequency can be decided by following formula FSCLK MCLK m n 2 The parameter m and n are decided by register ICCRO w
5. Read data from EEPROM and sub address is 0x01 variable Read l2C 0xa0 0x01 MCU AN 500052 E 10 Page 8 I2C Library Usage API V1 0 Chapter 4 Usage Demo FUJITSU 4 Usage Demo This chapter describes the steps of how to use this library and some usage cautions 4 1 Usage Steps of MB95F310 MCU lt First step is adding 12C library to project document Figure 4 1 is a sample for adding this library File Edit View Favorites Tools Help Q sax v 3 J2 Search lic Folders ess C DesktopiMCU AN 500083 E 12 IIC EVB v1 2lsrc ADC c addressjudge c File and Folder Tasks Y C File C File 2 KB 1 KB Other Places def h extinterrupt c H File a MCLI AN 500083 E 12 IIC 1 KB My Documents hfile h My Computer H File My Network Places 1 KB initial c il C File Details 1 KB i2c c slavemodei2c c standby c C File C File C File Date Modified 2111518 H 3H 4 KB 2KB 11 24 Size 8 50 KB startup asm timer c ASM File C File 5 KB 2 Figure 4 1 First Step of Use 12C Library lt Second step is adding 20 library to project Figure 4 2 is a sample for this work EEH Workspace i2c Add Member cB 12 abs i2c prj 46 cc Source i Thy Look in sre y E3 N E ener new folder ee Add Member to folder gt Bes E STA Set Directory A vec Include Make Depende Build vectors mH B Delete Property
6. 25 and R26 can select from 1K Q to 10k 0 MCU AN 500052 E 10 Page 13 FUJITSU 120 Library Usage API V1 0 Chapter 5 Debugging When debugging user can write or read data from EEPROM In this project global variable Dat Test is used to save the data read from slave device Figure 5 2 is a debugging picture User can see read result in watch window Edit View Project Debug Setup Window Help Woes se som 8 8 e w zl eala s exp a s Titorkspace 120 B I2C abs I2C prj Source Files 4 Include Files 5 void main void e 6 B Dependencies unsigned char Dat_Test Debug 8 k emulate_i2c sup 9 InitIrqLevels 120 sup 10 EI 11 12 13 while 1 14 15 Wr ite izc 0xa0 0x01 0x25 16 Read i2c 0xa0 0x01 LE ot Fel aragT acn EO mai weet Figure 5 2 See Variable Dat_Test MCU AN 500052 E 10 Page 14 120 Library Usage API V1 0 FUJITSU Chapter 6 Additional Information 6 Additional Information For more information about how to use MB95310 EV board BGM Adaptor and SOFTUNE please refer to EV Board MB2146 450 E User Manual or visit websites English version http www fujitsu com cn fsp services mcu mb95 application_notes html Simplified Chinese Version http www fujitsu com cn fss services mcu mb95 application_notes html M
7. CU AN 500052 E 10 Page 15 FUJITSU 120 Library Usage API V1 0 Chapter 7 Appendix 7 Appendix Table 2 1 l2C Functions 5 Tabl 3 12 AD Init FUNCION eee orienter a drea te soa ba xr oda se 6 Table 3 2 Describes Write 120 Function ccccccceecceecceeceeeceeeeeeeseeeeceeeeeeeeeeseeeseeeseeeseeeeeeess 7 Table 3 3 Read 20 Function nnennnnnnnenrnerenerrrerrrrrrrerrrererrrerrererrrrrerrrrrrrrrererrrerrrrrrreereeene 8 Figure 4 1 First Step of Use 120 Library seeseessesseeeeeeeeeeeeennmeenn nnne 9 Figure 4 2 Second Step of Use I2C Library 5 trn te tnr bkn erster nisu 9 Figure 4 3 Example of Writing sss succi eade quascumque as RAS 10 Figure 4 4 Example icu to uar hel db cei coded 10 Figure 4 5 Step of Setting Debug Environment ssssseeemmene 11 Figure 5 1 Hardware Description UM 13 Figure 5 2 See Variable Dat 6 14 MCU AN 500052 E 10 Page 16
8. fined under the law 2009 Fujitsu Semiconductor Shanghai Co Ltd MCU AN 500052 E 10 Page 2 co 120 Library Usage API V1 0 CONTENTS FUJITSU CONTENTS REVISION HISTORY er 2 CONTENTS 3 1 isses 4 2 12C LIBRARY FUNCTION LIST Ki ERGEA 5 3 12C FUNCTION 6 lnitial I2 C 6 3 2 Write 120 FUNCtHON 7 3 3 Read 20 Function ccccceeesssesseesssesssessseesssesseesssesseesseeeseeeseeeseeeseeeseeeseeeeseeeeees 8 4 USAGE 9 4 1 Usage Steps MB95F310 eee ce eeeneceeeeeeeeeeeeeeaaeeeeeeaaeeestesneeeeeneeneeees 9 4 2 Software Usage Attention gets aioe ce esc 12 4 3 Sequence of Data Transfer eessssssssssseseeseseseeene nennen nnne enn 12 13 6 ADDITIONAL INFORMAT ION ssaasssunnnnnunnnnnnunnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnmnnn nnn 15 TEE gh RRR nn OE OR T 16 MCU AN 500052 E 10 Page 3 FUJITSU 120 Library Usage API V1 0 Chapter 1 Introduction 1 Introduction This document introduces API for 12C library Fujitsu MCU MB95F310 has I2C module and it can be used by connecting master device to slave device In following chapter we will describe the library of Fujitsu MCU MB95F310 MCU AN 500052 E 10 Page 4 co 120 Library Usage
9. hich is used in initial function User can ignore it when using 6M MCLK and 23 KHz shift clock frequency MCU AN 500052 E 10 Page 6 co 120 Library Usage API V1 0 Chapter 3 I2C Function Detail FUJITSU 3 2 Write I2C Function Table 3 4 describes Write I2C function Function prototype Table 3 2 Write 20 Function void Write I2C unsigned char addr unsigned char subadd unsigned char data Behavior description Writes data to slave chip Input parameter1 addr address of slave chip range is 0x00 to Oxff Input parameter2 subadd sub address of slave chip range is 0x00 to Oxff Input parameter3 data data which write to slave chip range is 0x00 to Oxff Return value None Example In case slave chip is EEPROM and it s address is Oxa0 then write 0x25 to EEPROM sub address 0x01 Write I2C 0xa0 0x01 0x25 MCU AN 500052 E 10 Page 7 FUJITSU 120 Library Usage API V1 0 Chapter 3 I2C Function Detail 3 3 Read 126 Function Table 3 5 describes Read 20 function Table 3 3 Read l2C Function Function name AD Read Function prototype unsigned char Read l2C unsigned char addr unsigned char subaddr Behavior description Read data from slave chip Input parameter1 addr address of slave chip rang is 0x00 to Oxff Input parameter2 subadd sub address of slave chip rang is 0x00 to Oxff Return value Data saved in slave chip sub address Example
10. ive owners Fujitsu Semiconductor Shanghai Co Ltd Application Note F2MC 8FX FAMILY 8 BIT MICROCONTROLLER MB95310 370 SERIES I2C LIBRARY USAGE API APPLICATION NOTE co FUJITSU FUJITSU 120 Library Usage API V1 0 Revision History Revision History Author Change of Records 2009 11 10 Jane Li V1 0 First draft 2011 03 17 Jane Li Modify Chinese remark This manual contains 16 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 4 The products contained in this manual are not intended for use with equipments which require extremely high reliability such as aerospace equipments undersea repeaters nuclear control systems or medical equipments 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 thereof must not be exported without permission as de
11. re protection and 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 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 respect
12. sing controllers 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 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 fi
Download Pdf Manuals
Related Search
Related Contents
Bon de commande intra-auriculaires sur-mesure Quest User`s Manual InstallatIon · Manual 5.0635.09.52 V2.0 1/2 Harbor Freight Tools 1000 lb. Capacity 9 in. x 72 in. Tri_Fold Loading Ramps, Set of Two Product manual 注意 - アイエススプリンクラー KM-11T(6MB) ITV07 01-20.qxd - Institut Francais de la Vigne et du Vin DCR-SR37E/SR38E/SR47E/SR48E/SR57E/ SR67E/SR77E/SR87E MÉXICO - lapem Copyright © All rights reserved.
Failed to retrieve file