《盛群单片机-简介.ppt》由会员分享,可在线阅读,更多相关《盛群单片机-简介.ppt(59页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、IntroductionofHoltekHT-46seriesMCU盛群半導體盛群半導體(股股)公司公司客戶技術服務處客戶技術服務處高克湘高克湘涂元崧涂元崧邱昱文邱昱文3/3/2023ContentFamilyofA/DTypeMCUi.Cost-EffectiveA/DtypeMCUii.A/DtypeMCUiii.A/DwithLCDtypeMCUiv.A/DwithVFDtypeMCUDetailofHT46R24i.FeaturesofHT46R24ii.BlockDiagramiii.FunctionDescription(ROM,RAM,Interrupt,I/O,Timer,Bu
2、zzer,Oscillator,ADC,I2C,PWM,.)3/3/2023Cost-Effective A/D Type MCU3/3/2023A/D Type MCU3/3/2023A/D with LCD Type MCU3/3/2023Features of HT46R243/3/2023Block Diagram3/3/2023HT46X24PINASSIGMENT3/3/2023Program ROM and Interrupt Vector3/3/2023RAM MAPPING3/3/202363 InstructionsArithmeticlADD,SUBIncrement&D
3、ecrementlINC,INCA,DECLogicOperationlAND,OR,XORRotatelRR,RRC,RLDataMovelMOVBitoperationlSET,CLRTableReadlTABRDC,TABRDLBranchlJMP,SZ,RET,RETIMiscellaneouslNOP,SWAP,HALT3/3/2023Arithmetic 3/3/2023Logic 3/3/2023Increment,Decrement,Rotate,Data Move,Bit Operation 3/3/2023Branch 3/3/2023Table Read,Miscella
4、neous 3/3/2023Indirect AddressingIndirectaddressingRegister:lIRA0,IRA1.MemoryPointers:lMP0,MP1.3/3/2023Status Register3/3/2023I/O Structure3/3/2023InterruptInterrupthaspriorityissue.Onceaninterruptsubroutineisserviced,alltheotherinterruptswillbeblock(bycleaningtheEMIflag).Afterthesubroutinesetthe“RE
5、TI”,theEMIwillbesetagain.3/3/2023Interrupt control register3/3/2023Interrupt Scheme3/3/2023Timer/Event Counter 03/3/2023Timer/Event Counter 13/3/2023Timer Control Register 03/3/2023Timer Control Register 13/3/20233 modes available for the Timer/Counter1.TimerMode2.EventCounterMode3.PulseWidthMode3/3
6、/20234 steps to setup in the Timer Mode1.SettoTimerModebywriting10toTM1,TM02.SettheinitialtimerTMRvalue3.EnablethecorrespondinginterruptbysettingtheETIandEMIbit4.StarttheTimerbysettingtheTONbitoftheTMRC3/3/20235 steps to setup in the Even Counter Mode1.SettoEventCounterModebywriting01toTM1,TM02.Sele
7、ctTE=1tocountonthefallingedgeorTE=0tocountontherisingedge3.SettheTimerinitialvalueintoTMR4.EnablethecorrespondinginterruptbysettingtheETIandEMIbits5.StarttheTimerbysettingtheTONbitintheTMRCregister3/3/20235 steps to setup in the Pulse Width Measurement Mode1.SettoPulseWidthModebywriting11toTM1,TM02.
8、SelectTE=1tomeasureaHighPulseWidthandTE=0tomeasureaLowPulseWidth3.SettheTimerinitialvalue,TMR,usuallysetto0HforPulseWidthMeasurements4.EnablethecorrespondinginterruptbysettingtheETIandEMIbits5.StarttheTimerbysettingtheTONbitintheTMRC3/3/2023Programmable Frequency Divider(PFD)and BuzzerPFDispinshared
9、withPA3(selectedviaconfigurationoptional).ClocksourceofPFDiscomefromtimer0ortimer1overflowsignal(selectedviaconfigurationoptional).PFDoutputiscontrolledbyswitchon/offPA3.3/3/2023Watchdog TimerThewatchdogtimerisprovidedtopreventprogramuncontrollable.3clocksourcescanbeselectedaswatchdogtimingsource:(b
10、yconfiguration)lT1(fsys/4),32KHzRTC,WDTOSCoutput.lAtHALT,onlyWDTOSCorRTCoscillatorisstillrunning.3/3/2023Watchdog RegisterIfwatchdogtimeout,thesystemwillbereset.Thestatusbit“TO”willbeset.Therearetwomethodofusingsoftwaretoclearwatchdogtimer(selectedbyconfiguration):lOneinstruction:CLRWDTlTwoinstructi
11、on:CLRWDT1,CLRWDT23/3/2023PWMPWMisPulseWidthModulator.Therearetwomodes6+2or7+1selectedbyconfiguration.UsercanchangethedutycyclebysoftwarelbywritingdatatoPWM0PWM3specialdataregister.PWMfunctioncanbecontrolledOn/Offbysoftware.lEnablePWMoutput:SETPD0lDisablePWMoutput:CLRPD03/3/2023PWM 6+2 Mode3/3/2023P
12、WM 7+1 Mode3/3/2023Analog to Digital ConverterTheHT46R24hasa10-bitADC.ADCcanbedisabledbysoftware.Max.4or8channelscaninputtotheADC.lChannelssetinADCRbysoftwareADCchannelsarepin-sharedwithPortB.lAsADCinputorPortBsetinADCRbysoftwareInputrangeisfrom0toVDD.Min.ADCclockperiodis1us.ADCsamplingtimeis32ADCcl
13、ocks.ADCconverttimeis76ADCclocks.Max.INL1LSB.3/3/2023ADC Convert Data RegisterADRL/ADRHaretworegisterstostoretheADCconvertdata.3/3/2023A/D Convert Control Register3/3/2023A/D Convert Clock Source Register3/3/2023A/D Convert Timing Diagram3/3/2023I2C Bus InterfaceI2Cbusisabidirectional2-wireserialint
14、erface.lSCL:serialclockpin.lSDA:serialdatapin.I2Coutputisofopendrain.Anexternalpullhighresistorisneeded.HT46seriesI2CbusisonlyoperatesinSlavemode.ForMastermode,usercanimplementbysoftware.3/3/2023Data transfer on the I2C-bus3/3/2023I2C relative RegistersI2CSlaveAddressRegister-HADRI2CInput/OutputData
15、RegisterHDRI2CControlRegisterHCR.I2CStatusRegisterHSR.3/3/2023HADR Register3/3/2023HDR Register3/3/2023HCR Register3/3/2023HSR Register3/3/2023I2C Bus CommunicationSTEP1lWritetheslaveaddressofthemicrocontrollertotheHADR.STEP2lSettheHEN(bit7ofHCR)to1toenabletheI2Cbus.STEP3lSettheEHI(bit2ofINTC1)to1to
16、enableI2Cinterrupt3/3/2023I2C Bus ISR Flow Chart3/3/2023HALTThesystemoscillatorwillbeturnedoff.AlloftheI/OportsandRAMremainunchanged.TheWDTwillbeclearedandresumecountingiftheWDTclocksourceisselectedtocomefromtheWDToscillator.ThePDFissetandtheTOiscleared.3/3/2023How to wake up from HALT modeExternalR
17、esetExternalInterruptFallingedgesignalonportAWDToverflow3/3/2023RESETPoweronresetResetpinresetLowVoltageResetWDTreset3/3/2023LowVoltageReset3/3/2023Register Initial Status(1)3/3/2023Register Initial Status(2)3/3/2023Register Initial Status(3)3/3/2023Application Circuit3/3/2023Configuration Options3/3/2023