Home
User Manual, Guide Book, Application Notes and Some
Contents
1. DelayUS 2 SCL 1 DelayUS 2 uRBytec 1 uRByte UCHAR SDA SCL 0 return uRByte MCU AN 500034 E 11 Page 18 SW Realization Using GPIO V 1 1 co Chapter 4 Typical Application FUJITSU 4 Typical Application 4 1 HW Design In this application MB95F204K is used as MCU chip and E2PROM 24 08 is used as the device The HW is designed as Figure 5 P62 P63 EB95F204K AT24C08 Figure 5 Hardware Design MCU AN 500034 E 11 Page 19 co SW Realization Using GPIO V 1 1 FUJITSU Chapter 4 Typical Application 4 2 Sample Code The codes are applied to 24 08 Please refer to the AT24C08 manual for more information In the demo the address for AT24C08 is set as and the baudrate is set as 1 kbit s BOOL Rom Write UBYTE romAddr UBYTE datAddr UBYTE data Return 1 success Parameters romAddr the AT24C08 address datAddr the memory space address data data written to the AT24C08 Description Write a data to the AT24C08 by Example BOOL bSuc bSuc Rom_Write OxA0 0x35 0x62 BOOL Rom Write UBYTE romAddr datAddr UBYTE data Start Write8Bit romAddr amp OxFE I2C write address if GetAck return FALSE Write8Bit datAddr if GetAck return FALSE Write8Bit dat if GetAck return FALSE stop return TRUE MCU AN 500034 E 11 Page 20 SW Realization Using GPIO
2. Return 0 failure 1 success Parameters None Description Get an acknowledge from the Example BOOL bAck GetAck BOOL GetAck SCL 0 DelayUS 2 SDA 1 DDR6 P62 0 SDA IN SCL 1 DelayUS 2 return SDA FALSE MCU AN 500034 E 11 Page 15 co SW Realization Using GPIO V 1 1 FUJITSU Chapter 3 12C Driver void NoAck Return None Parameters None Description Set a no acknowledge on the 12 Example NoAck void NoAck SCL 0 DelayUS 2 SDA 1 DDR6 P62 1 SDA OUT DelayUS 2 SCL 1 DelayUS 2 MCU AN 500034 E 11 Page 16 SW Realization Using GPIO V 1 1 co Chapter 3 12C Driver FUJITSU void Write8Bit UCHAR Return None Parameters uDat 8 bit data Description Write a 8 bit data on the Example Write8Bit 0x63 void Write8Bit UCHAR uDat 1 SCL 0 DDR6_P62 1 SDA OUT for i 8 i 20 i DelayUS 2 SDA uDat amp 0x80 1 0 DelayUS 2 SI DelayUS 2 SCL 0 uDat lt lt 1 MCU AN 500034 E 11 Page 17 SW Realization Using GPIO V 1 1 co FUJITSU Chapter 3 I2C Driver UCHAR ReadBBit Return Data from Parameters None Description Read a 8 bit data from the Example UCHAR tmp tmp Read8Bit UCHAR Read8Bit UCHAR i UCHAR uRByte 0 SCL 0 SDA 1 DDR6 P62 0 SDA IN 5 Os
3. Buslnit Return None Parameters None Description Initialize the Example I2C_Buslnit vordi 2 CEBUS TNIE DDR6 P62 1 SDA OUT DDR6 P63 1 SCL OUT PDR6 62 0 SDA 0 PDR6 P6320 SCL 0 void DelayUS UINT nDly Return None Parameters nDly delay US Description Delay nDly on the Example DelayUS 3 void DelayUS UINT nDly fomir mui 0 Note The clock loop varies depending MCU please change the DelayUS function to realize the s delay MCU AN 500034 E 11 Page 13 FUJITSU void Start SW Realization Using GPIO V 1 1 Chapter 12C Driver Return None Parameters None Description Start transfer Example Start EE S t 2 8 SCL 0 SDA 1 DDR6 P62 1 DelayUS 2 SCL I DelayUS 2 SDA 0 DelayUS 2 SDA OUT void Stop Return None Parameters None Description Stop transfer Example SCL 0 SDA 0 DDR6_P62 1 DelayUS 2 SCL 1 DelayUS 2 SDA 1 DelayUS 2 SDA OUT MCU AN 500034 E 11 Page 14 SW Realization Using GPIO V 1 1 co Chapter 3 12C Driver FUJITSU void SetAck Return None Parameters None Description Set an acknowledge on the Example SetAck void SetAck SCL 0 DelayUS 2 SDA 0 DDR6 P62 1 SDA OUT DelayUS 2 SCL 1 DelayUS 2 BOOL GetAck
4. Chapter 6 More Information 6 More Information For more information on FUJITSU MB95200 products please visit following 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 MCU AN 500034 E 11 Page 24 SW Realization Using GPIO V 1 1 co Chapter 7 Appendix FUJITSU 7 Appendix Figure 1 START Condition and STOP Condition esses 6 Figure 2 Data Transfer on the 8 Figure Acknowledge on the l C bus ccscccsssesssesssessssssusesusssesssecssesseessesssesssesssecsneesneeaees 9 Figure 4 A Complete Data Transfer on the 10 Figure S BardwareJDeSlgfi i dre 19 Figure 6 Write VV AVG 22 Figure 7 Read HERENNIUM 22 MCU AN 500034 E 11 Page 25
5. GPIO V 1 1 co FUJITSU Chapter 1 Introduction 1 Introduction In this document we will introduce how to use the GPIO to realize function on the MB95200 series MCU AN 500034 E 11 Page 4 SW Realization Using GPIO V 1 1 co Chapter 2 Overview 01126 FUJITSU 2 Overview of 2 1 Background In consumer electronics telecommunications and industrial electronics there are often many similarities among different designs The following blocks are nearly included in every system Some intelligent control usually a single chip microcontroller General purpose circuits like LCD drivers remote ports RAM E2PROM or data converters Application oriented circuits such as digital tuning and signal processing circuits for radio and video systems or DTMF generators for telephones with tone dialing In these blocks listed above the control and communication among different chips may be performed To maximize hardware efficiency and circuit simplicity Philips developed a simple bi directional 2 wire bus for efficient inter IC control This bus is called inter IC I C bus Now Philips IC includes more than 150 CMOS and bipolar I C bus compatible used to perform corresponding functions mentioned above All compatible with devices build in an on chip interface which supports them to communicate directly each other via I C bus This concept has solved many problems related to interface when designing
6. V 1 1 co Chapter 4 Typical Application FUJITSU UBYTE Rom Read UBYTE romAddr UBYTE datAddr Return data from 24 08 Parameters 24 08 address datAddr the memory space address Description Read data from the 24 08 by Example UBYTE tmp tmp Rom Read 0xA1 0x35 UBYTE Rom Read UBYTE romAddr UBYTE datAddr UBYTE value Write8Bit romAddr amp OxFE I2C write address if GetAck return FALSE Write8Bit datAddr if GetAck FALSE Write8Bit romAddr 0x01 I2C read address if GetAck return FALSE value Read8Bit NoAck SEO Ore return value MCU AN 500034 E 11 Page 21 SW Realization Using GPIO V 1 1 co FUJITSU Chapter 1 4 3 Wave E2PROM Read and Write Wave 4 3 1 Write gt Write 0xA0 0X11 0X35 Figure 6 Write Wave 4 3 2 Read Wave Rom Read 0xA1 0X11 Figure 7 Read Wave MCU AN 500034 E 11 Page 22 SW Realization Using GPIO V 1 1 co Chapter 5 Notes on Items FUJITSU 5 Notes on Items address bitO setting The is set as 1 in read mode and is set as in write mode In the function void DelayUS UINT nDly the nDly is different from the other MCU Please set the nDly according to MCU MCU AN 500034 E 11 Page 23 SW Realization Using GPIO V 1 1 co FUJITSU
7. Fujitsu Semiconductor Shanghai Co Ltd Application Note F 2MC 8FX FAMILY 8 BIT MICROCONTROLLER MB95200 SERIES SW REALIZATION USING GPIO APPLICATION NOTE cO FUJITSU FUJITSU SW Realization Using GPIO V 1 1 Revision History Revision History Date Author Change of Records 2009 02 04 V1 0 First draft 2009 03 24 V1 1 Modify the format This manual contains 25 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 The contents of this manual may not be transferred or copied without the express permission of Fujitsu The products contained in this manual 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 thereof must not be exported without permission as defined under the law 2008 Fujitsu Semi
8. a repeated START Sr is generated instead of a STOP condition In the case above the function of the START S condition and the repeated START Sr condition are regarded as the same It is easy to detect the START condition and the STOP condition by devices connected to the bus if they build in necessary hardware interface However if the controller does not have such interface it must sample the SDA line at least twice per clock period so that the master can recognise the START condition and the STOP condition SDA SDA START condition STOP condition Figure 1 START Condition and STOP Condition MCU AN 500034 E 11 Page 6 SW Realization Using GPIO V 1 1 co Chapter 2 Overview of I2C FUJITSU 2 2 2 Byte Format Each byte on the SDA line should be 8bits long The number of bytes that can be transferred at a time is arbitrary Each byte should be followed by an acknowledge bit Data transfer starts from the most significant bit MSB first If the slaver can not receive or transfer a complete byte data for example an internal interrupt processing SCL line should be set as LOW to force the master into a wait sate Data transfer can be performed until the slaver is ready for next byte data and releases SCL line In some cases you can use a format different I C bus format for example CBUS compatible devices A message which starts with such an address ca
9. conductor Shanghai Co Ltd MCU AN 500034 E 11 Page 2 SW Realization Using GPIO V 1 1 FUJITSU CONTENTS Revisi n History s eid dace ae cs Pur tcs cane eats deeds cer ads ambi RE dasa rSn PH EPIS E EET dU E 2 we az py EM 3 ME uper RE 4 2 Overview P ape 5 e cll cc 5 22 SE 6 2 2 1 START Condition and STOP Condition 6 2 2 2 nates 7 2 2 3 Acknowledge T 8 2 2 4 A Complete Data 10 NE CRIT 11 o Pa Usage cp 11 3 2 Driver 12 3 2 1 General C 12 9 2 2 voco one E ME 13 4 Typical Application mE 19 HW Desig A A NE aS 19 4 2 Sample 20 43 gt Wave E2PROM Read and Write 22 4 3 1 Write Wave Rom Write 0 0 11 0 35 22 4 3 2 Read Wave Rom Read 0 1 0 11 22 Notes MOIS 23 More Information asm cioe dicono Emo 24 T f PH 25 MCU AN 500034 E 11 Page 3 SW Realization Using
10. digital control circuits Here are some features of I C bus Only two lines are required a serial data line SDA and a serial clock line SCL For each device connected to the bus only an independent address and a simple master slaver relationship are needed The master can operate as a transmitter or a receiver A true multi master mode can be realized only by bus arbitration and collision detection In 8 bit bi directional serial transfer data transfer rate can be up to 100 Kbit s in standard mode and up to 400 Kbit s in fast mode and up to 3 4 Mbit s in high speed mode On chip bus filtering function can preserve the integrity of communication data on the bus The number of ICs that can be connected to the same bus is limited only by a maximum bus capacitance of 400 pF MCU AN 500034 E 11 Page 5 SW Realization Using GPIO V 1 1 co FUJITSU Chapter 2 Overview of I2C 2 2 Protocol 2 2 1 START Condition and STOP Condition In communication START S condition and STOP P condition should be set respectively SDA line is changed from HIGH to LOW while SCL is HIGH this case is defined as a START condition SCL is changed from LOW to HIGH while SCL is HIGH this case is defined as a STOP condition The START condition and the STOP condition are always generated by the master The bus is busy when the START condition is generated and is free when the STOP condition is generated The bus also remains busy if
11. it can generate a repeated START condition Sr and address another slaver without generating a STOP condition first This way above can be used for various read write formats START ADDRESS RW ACK condition condition Figure 4 A Complete Data Transfer on the MCU AN 500034 E 11 Page 10 SW Realization Using GPIO V 1 1 c Chapter 3 12C Driver FUJITSU 3 Driver 3 1 Peripheral Usage The MCU pins are used as below P62 used as SDA P63 used as SCL MCU AN 500034 E 11 Page 11 SW Realization Using GPIO V 1 1 co FUJITSU Chapter 12C Driver 3 2 Driver Code 3 2 1 General Definition typedef unsigned char BOOLEAN typedef unsigned char INT8U Unsigned 8 bit quantity typedef signed char INT8S Signed 8 bit quantity typedef unsigned int INT16U Unsigned 16 bit quantity typedef signed int INT16S Signed 16 bit quantity typedef unsigned long INTS2U Unsigned 32 bit quantity typedef signed long INT32S Signed 32 bit quantity define BOOL BOOLEAN define BYTE INT8U define UBYTE INT8U define WORD INT16U define UWORD INT16U define LONG INT32S define ULONG INT32U define UCHAR INT8U define UINT INT16U define DWORD INT32U define TRUE 1 define FALSE 0 define SDA PDR6_P62 define SCL PDR6_P63 MCU AN 500034 E 11 Page 12 SW Realization Using GPIO V 1 1 co Chapter 3 12C Driver FUJITSU 3 2 2 Routines void 12
12. n be terminated by generating a STOP condition even during a byte transfer In this case a no acknowledge is generated MCU AN 500034 E 11 Page 7 co SW Realization Using GPIO V 1 1 FUJITSU Chapter 2 Overview of I2C 2 2 3 Acknowledge An acknowledge is necessary for data transfer The clock pulse related to acknowledge is generated by the master During the acknowlede clock pulse the transmitter releases the SDA line HIGH the receiver pulls down the SDA line and always remains LOW during the HIGH period of the clock pulse Please note that setup time and hold time should also be considered Usually a receiver which has been addressed generates an acknowledge every time after a byte data is received An exception is that the receiver accesses on CBUS addressing and sends a message If a slaver can not recognise the slave address for example it is performing some real time function the SDA line should be left HIGH by the slaver In this case the master sholuld terminate data transfer by generating a STOP condition or start a new transfer by generating a repeated START condition If a slave receiver does not receive any byte data for some time after recognising the slave address the master must terminate data transfer again If the slaver generates a no acknowledge immediately after the first byte the slaver will set SDA as HIGH so the master should generate a STOP condition or a repeated START condition If the maste
13. r receiver also performs data transfer it should send a no acknowlede to the slave transmitter when the slaver has sent the last data The slave transmitter must release the SDA line so that the master can generate a STOP condition or a repeated START condition 9 acknowledgement acknowledgement signal from slave signal from receiver e complete interrupt within slave clock line held low while interrupts are serviced 5 Sr or 1 2 Sr P START or STOP or repeated START repeated START condition condition Figure 2 Data Transfer on the C bus MCU AN 500034 E 11 Page 8 SW Realization Using GPIO V 1 1 co Chapter 2 Overview of I2C FUJITSU not acknowledge acknowledge DATA OUTPUT BY TRANSMITTER DATA OUTPUT BY RECEIVER SCL FROM MASTER s START condition Figure Acknowledge on the I C bus clock pulse for acknowledgement MCU AN 500034 E 11 Page 9 SW Realization Using GPIO V 1 1 co FUJITSU Chapter 2 Overview of I2C 2 2 4 A Complete Data Transfer Data transfer format is shown in Figure 4 as below A slave address is transferred after the START condition S is generated This address is 7 bits long followed by the eighth bit which is a data direction bit R W 0 Write 1 Read Data transfer is always terminated by the STOP condition P generated by the master However if the master still needs to perform data transfer on the bus
Download Pdf Manuals
Related Search
Related Contents
reyaq-p_om_4pw62583-1_pt STR-DH820 - Sony Europe 5年 - 大阪府立大学工業高等専門学校 Manual do Usuário - Epson America, Inc. PLATAFORMA WEB DE ENTIDADES EDUCATIVAS ADITIVO ANTIBACTERIAS Adams 22 Lawn Mower User Manual SERVICE MANUAL - Appliance Factory Parts Samsung RT37GBSS User Manual Features Copyright © All rights reserved.
Failed to retrieve file