Rev. 1.20 112 January 23, 2015 Rev. 1.20 113 January 23, 2015
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
I
2
C Bus Initialisation Flow Chart
I
2
C Bus Start Signal
TheSTARTsignalcanonlybegeneratedbythemasterdeviceconnectedtotheI
2
Cbusandnotby
theslavedevice.ThisSTARTsignalwillbedetectedbyalldevicesconnectedtotheI
2
Cbus.When
detected,thisindicatesthattheI
2
CbusisbusyandthereforetheIICHBBbitwillbeset.ASTART
conditionoccurswhenahightolowtransitionontheSDAlinetakesplacewhentheSCLline
remainshigh.
Slave Address
ThetransmissionofaSTARTsignalbythemasterwillbedetectedbyalldevicesontheI
2
Cbus.
Todeterminewhichslavedevicethemasterwishestocommunicatewith,theaddressoftheslave
devicewillbesentoutimmediatelyfollowingtheSTARTsignal.Allslavedevices,afterreceiving
this7-bitaddressdata,willcompareitwiththeirown7-bitslaveaddress.Iftheaddresssentoutby
themastermatchestheinternaladdressofthemicrocontrollerslavedevice,thenaninternalI
2
Cbus
interruptsignalwillbegenerated.Thenextbitfollowingtheaddress,whichisthe8thbit,denes
theread/writestatusandwillbesavedtotheIICSRWbitoftheIICC1register.Theslavedevicewill
thentransmitanacknowledgebit,whichisalowlevel,asthe9thbit.Theslavedevicewillalsoset
thestatusagIICHAASwhentheaddressesmatch.
AsanI
2
Cbusinterruptcancomefromthreesources,whentheprogramenterstheinterrupt
subroutine,theIICHAASandI2CTOFbitsshouldbeexaminedtoseewhethertheinterruptsource
hascomefromamatchingslaveaddressorfromanI
2
Ccommunicationtime-outorfromthe
completionofadatabytetransfer.Whenaslaveaddressismatched,thedevicemustbeplacedin
eitherthetransmitmodeandthenwritedatatotheIICDregister,orinthereceivemodewhereit
mustimplementadummyreadfromtheIICDregistertoreleasetheSCLline.