Rev. 1.71 68 April 11, 2017 Rev. 1.71 69 April 11, 2017
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
PTM
PTPn
PTCKn
Capture Input
TCK Input
Output
PTPnI
PTPnB
Inverting Output
PTM Function Pin Control Block Diagram
Programming Considerations
TheTMCounterRegistersandtheCapture/CompareCCRAregister,andCCRPregisterpairfor
PeriodicTimerModule,allhavealowandhighbytestructure.Thehighbytescanbedirectly
accessed,butasthelowbytescanonlybeaccessedviaaninternal8-bitbuffer,readingorwriting
totheseregisterpairsmustbecarriedoutinaspecicway.Theimportantpointtonoteisthatdata
transfertoandfromthe8-bitbufferanditsrelatedlowbyteonlytakesplacewhenawriteorread
operationtoitscorrespondinghighbyteisexecuted.
AstheCCRAregisterandCCRPregistersareimplementedintheway showninthefollowing
diagramandaccessingtheregisteriscarriedoutCCRP low byte register using thefollowing
accessprocedures.AccessingtheCCRAorCCRPlowbyteregisterwithoutfollowingtheseaccess
procedureswillresultinunpredictablevalues.
8-bit Buffer
PTMnDHPTMnDL
PTMnRPHPTMnRPL
PTMnAH
PTMnAL
PTM Counter Register (Read only)
PTM CCRA Register (Read/Write)
PTM CCRP Register (Read/Write)
Data Bus
8-bit Buffer
STMDH
STMDL
STM0AHSTM0AL
STM Counter Register (Read only)
STM CCRA Register (Read/Write)
Data Bus
Thefollowingstepsshowthereadandwriteprocedures:
• WritingDatatoCCRAorPTMCCRP
♦
Step1.WritedatatoLowByteSTM0ALPTMnALorPTMnRPL
– notethatheredataisonlywrittentothe8-bitbuffer.
♦
Step2.WritedatatoHighByteSTM0AHPTMnAHorPTMnRPH
– heredataiswrittendirectlytothehighbyteregistersandsimultaneouslydataislatched
fromthe8-bitbuffertotheLowByteregisters.
• ReadingDatafromtheCounterRegistersandCCRAorPTMCCRP
♦
Step1.ReaddatafromtheHighByteSTM0DH,STM0AHPTMnDH,PTMnAHorPTMnRPH
– heredataisreaddirectlyfromtheHighByteregistersandsimultaneouslydataislatched
fromtheLowByteregisterintothe8-bitbuffer.
♦
Step2.ReaddatafromtheLowByteSTM0DL,STM0ALPTMnDL,PTMnALorPTMnRPL
– thisstepreadsdatafromthe8-bitbuffer.