EasyManua.ls Logo

Holtek BS82B12A-3 - I 2 C B�S Comm�Nication

Holtek BS82B12A-3
168 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
TheIICDregisterisusedtostorethedatabeingtransmittedandreceived.Beforethedevicewrites
datatotheI
2
Cbus,theactualdatatobetransmittedmustbeplacedintheIICDregister.Afterthe
dataisreceivedfromtheI
2
Cbus,thedevicecanreaditfromtheIICDregister.Anytransmissionor
receptionofdatafromtheI
2
CbusmustbemadeviatheIICDregister.
IICD Register
Bit 7 6 5 4 3 2 1 0
Name IICD7 IICD6 IIC
D5 IICD4 IICD3 IICD2 IICD1 IICD0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR x x x x x x x x
"x
" unknown
IICA Register
Bit 7 6 5 4 3 2 1 0
Name IICA6 IICA
5 IICA4 IICA3 IICA2 IICA1 IICA0
R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0
Bit7~1 IICA6~IICA0:I
2
Cslaveaddress
IICA6~IICA0istheI
2
Cslaveaddressbit6~bit0.
TheIICAregisteristhelocationwherethe7-bitslaveaddressoftheslavedevice
isstored.Bits7~1oftheIICAregisterdenethedeviceslaveaddress.Bit0isnot
dened.
Whenamasterdevice,whichisconnectedtotheI
2
Cbus,sendsoutanaddress,which
matchestheslaveaddressintheIICAregister,theslavedevicewillbeselected.
Bit0 Unimplemented,readas"0"
I
2
C Bus Communication
CommunicationontheI
2
Cbusrequiresfourseparatesteps,aSTARTsignal,aslavedeviceaddress
transmission,adatatransmissionandfinallyaSTOPsignal.WhenaSTARTsignalisplacedon
theI
2
Cbus,alldevicesonthebuswillreceivethissignalandbenotiedoftheimminentarrivalof
dataonthebus.Therstsevenbitsofthedatawillbetheslaveaddresswiththerstbitbeingthe
MSB.Iftheaddressoftheslavedevicematchesthatofthetransmittedaddress,theIICHAASbit
intheIICC1registerwillbesetandanI
2
Cinterruptwillbegenerated.Afterenteringtheinterrupt
serviceroutine,theslavedevicemustfirstchecktheconditionoftheIICHAASandI2CTOF
bitstodeterminewhethertheinterruptsourceoriginatesfromanaddressmatchorfromanI
2
C
communicationtime-outorfromthecompletionofan8-bitdatatransfer.Duringadatatransfer,note
thatafterthe7-bitslaveaddresshasbeentransmitted,thefollowingbit,whichisthe8thbit,isthe
read/writebitwhosevaluewillbeplacedintheIICSRWbit.Thisbitwillbecheckedbytheslave
devicetodeterminewhethertogointotransmitorreceivemode.Beforeanytransferofdatatoor
fromtheI
2
Cbus,themicrocontrollermustinitialisethebus,thefollowingarestepstoachievethis:
• Step1
SettheIICENbitintheIICC0registerhightoenabletheI
2
Cbus.
• Step2
WritetheslaveaddressofthedevicetotheI
2
CbusaddressregisterIICA.
• Step3
SettheIICEinterruptenablebitoftheinterruptcontrolregistertoenabletheI
2
Cinterrupt.

Table of Contents

Related product manuals