Rev. 1.20 72 January 23, 2015 Rev. 1.20 73 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
Programming Considerations
TheTMCounterRegistersandtheCapture/CompareCCRAandCCRPregisters,being10-bit,all
havealowandhighbytestructure.Thehighbytescanbedirectlyaccessed,butasthelowbytes
canonlybeaccessedviaaninternal8-bitbuffer,readingorwritingtotheseregisterpairsmustbe
carriedoutinaspecicway.Theimportantpointtonoteisthatdatatransfertoandfromthe8-bit
bufferanditsrelatedlowbyteonlytakesplacewhenawriteorreadoperationtoitscorresponding
highbyteisexecuted.
AstheCCRAandCCRPregistersareimplementedinthewayshowninthefollowingdiagramand
accessingtheseregistersiscarriedoutinaspecicwaydescribedabove,itisrecommendedtouse
the"MOV"instructiontoaccesstheCCRAandCCRPlowbyteregisters,namedxTMnALand
PTMnRPL,inthefollowingaccessprocedures.AccessingtheCCRAorCCRPlowbyteregister
withoutfollowingtheseaccessprocedureswillresultinunpredictablevalues.
Data Bus
8-bit
Buffer
xTMnDHxTMnDL
xTMnAHxTMnAL
xTMn Counter Register (Read only)
xTMn CCRA Register
(Read/Write)
PTMn CCRP Register (Read/Write)
PTMnRPHPTMnRPL
Thefollowingstepsshowthereadandwriteprocedures:
• WritingDatatoCCRAorCCRP
♦
Step1.WritedatatoLowBytexTMnALorPTMnRPL
– notethatheredataisonlywrittentothe8-bitbuffer.
♦
Step2.WritedatatoHighBytexTMnAHorPTMnRPH
– heredataiswrittendirectlytothehighbyteregistersandsimultaneouslydataislatched
fromthe8-bitbuffertotheLowByteregisters.
• ReadingDatafromtheCounterRegistersandCCRAorCCRP
♦
Step1.ReaddatafromtheHighBytexTMnDH,xTMnAHorPTMnRPH
– heredataisreaddirectlyfromtheHighByteregistersandsimultaneouslydataislatched
fromtheLowByteregisterintothe8-bitbuffer.
♦
Step2.ReaddatafromtheLowBytexTMnDL,xTMnALorPTMnRPL
– thisstepreadsdatafromthe8-bitbuffer.