Rev. 1.20 76 January 23, 2015 Rev. 1.20 77 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
Bit3 CT0ON:CTM0CounterOn/OffControl
0:Off
1:On
Thisbitcontrolstheoverallon/offfunctionoftheCTM0.Settingthebithighenables
thecountertorun,clearingthebitdisablestheCTM0.Clearingthisbittozerowill
stopthecounterfromcountingandturnofftheCTM0whichwillreduceitspower
consumption.Whenthebitchangesstatefromlowtohightheinternalcountervalue
willberesettozero,howeverwhenthebitchangesfromhightolow,theinternal
counterwillretainitsresidualvalue.
IftheCTM0isintheCompareMatchOutputModethentheCTM0outputpinwill
beresettoitsinitialcondition,asspeciedbytheCT0OCbit,whentheCT0ONbit
changesfromlowtohigh.
Bit2~0 CT0RP2~CT0RP0:CTM0CCRP3-bitregister,comparedwiththeCTM0Counter
bit9~bit7ComparatorPMatchPeriod
000:1024CTM0clocks
001:128CTM0clocks
010:256CTM0clocks
011:384CTM0clocks
100:512CTM0clocks
101:640CTM0clocks
110:768CTM0clocks
111:896CTM0clocks
ThesethreebitsareusedtosetupthevalueontheinternalCCRP3-bitregister,which
arethencomparedwiththeinternalcounter’shighestthreebits.Theresultofthis
comparisoncanbeselectedtocleartheinternalcounteriftheCT0CCLRbitissetto
zero.SettingtheCT0CCLRbittozeroensuresthatacomparematchwiththeCCRP
valueswillresettheinternalcounter.AstheCCRPbitsareonlycomparedwiththe
highestthreecounterbits,thecomparevaluesexistin128clockcyclemultiples.
Clearingallthreebitstozeroisineffectallowingthecountertooverflowatits
maximumvalue.
CTM0C1 Register
Bit 7 6 5 4 3 2 1 0
Name CT0M1 CT0M0 CT0IO1 CT0IO0 CT0OC CT0POL CT0DPX CT0CCLR
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
Bit7~6 CT0M1~CT0M0:SelectCTM0OperatingMode
00:CompareMatchOutputMode
01:Undened
10:PWMMode
11:Timer/CounterMode
ThesebitssetuptherequiredoperatingmodefortheCTM0.Toensurereliable
operationtheCTM0shouldbeswitchedoffbeforeanychangesaremadetothe
CT0M1andCT0M0bits.IntheTimer/CounterMode,theCTM0outputpincontrol
mustbedisabled.
Bit5~4 CT0IO1~CT0IO0:SelectTP0outputfunction
CompareMatchOutputMode
00:Nochange
01:Outputlow
10:Outputhigh
11:Toggleoutput
PWMMode
00:PWMOutputinactivestate
01:PWMOutputactivestate
10:PWMoutput
11:Undened