您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > dsp28335ADC模块讲解
ThepinofADC12-bitADCcorewithbuilt-indualsample-and-holdSimultaneoussamplingorsequentialsamplingmodesAnaloginput:0Vto3VFastconversiontimerunsat12.5MHz,ADCclock16-channel,multiplexedinputsSequencercanbeoperatedastwoindependent8-statesequencersorasonelarge16-statesequencer(i.e.,twocascaded8-statesequencers).SixteenresultregisterstostoreconversionvaluesMultipletriggersassourcesforthestart-of-conversionsequence–S/W-softwareimmediatestart–ePWM1-6–GPIOXINT2Flexibleinterruptcontrolallowsinterruptrequestoneveryend-of-sequence(EOS)oreveryotherEOSSequencercanoperateinstart/stopmodeSample-and-hold(S/H)acquisitiontimewindowhasseparateprescalecontrol1.CascadedModeSimultaneousSamplingCascadedSequencerModeExample2.DualSequencersSimultaneousSamplingDualSequencerModeExampleADCCoreClockandSample-and-Hold(S/H)ClockClockChaintotheADCstructADCTRL1_BITS{//bitsdescriptionUint16rsvd1:4;//3:0reservedUint16SEQ_CASC:1;//4CascadedsequencermodeUint16SEQ_OVRD:1;//5SequenceroverrideUint16CONT_RUN:1;//6ContinuousrunUint16CPS:1;//7ADCcoreclockpre-scalarADCUint16ACQ_PS:4;//11:8AcquisitionwindowsizeUint16SUSMOD:2;//13:12EmulationsuspendmodeUint16RESET:1;//14ADCresetADCUint16rsvd2:1;//15reserved};structADCTRL2_BITS{//bitsdescriptionUint16EPWM_SOCB_SEQ2:1;//0EPWMcompareBSOCmaskforSEQ2Uint16rsvd1:1;//1reservedUint16INT_MOD_SEQ2:1;//2SEQ2InterruptmodeUint16INT_ENA_SEQ2:1;//3SEQ2InterruptenableUint16rsvd2:1;//4reservedUint16SOC_SEQ2:1;//5StartofconversionforUint16RST_SEQ2:1;//6ResetSEQ2SEQ2复位Uint16EXT_SOC_SEQ1:1;//7ExternalstartofconversionforSEQ1Uint16EPWM_SOCA_SEQ1:1;//8EPWMcompareBSOCmaskforSEQ1Uint16rsvd3:1;//9reservedUint16INT_MOD_SEQ1:1;//10SEQ1InterruptmodeUint16INT_ENA_SEQ1:1;//11SEQ1InterruptenableUint16rsvd4:1;//12reservedUint16SOC_SEQ1:1;//13StartofconversiontriggerforSEQ1Uint16RST_SEQ1:1;//14Restartsequencer1Uint16EPWM_SOCB_SEQ:1;//15EPWMcompareBSOCenable};structADCASEQSR_BITS{//bitsdescriptionUint16SEQ1_STATE:4;//3:0SEQ1stateUint16SEQ2_STATE:3;//6:4SEQ2stateUint16rsvd1:1;//7reservedUint16SEQ_CNTR:4;//11:8SequencingcounterstatusUint16rsvd2:4;//15:12reserved};1.InitializetheDSPsystem;2.SetthePIEtheinterruptvectortable,3.InitializetheADCmodule;4.TheADCinterruptentryaddressintoPIEinterruptvectortable,opentheinterrupt;5.SoftwaretostarttheADCconversion;6.TheADCinterrupt;7.ReadtheADCconversionresultsintheADCinterrupt,softwaretostartthenextADCinterrupt.structADCMAXCONV_BITS{//bitsdescriptionUint16MAX_CONV1:4;//3:0MaxnumberofconversionsUint16MAX_CONV2:3;//6:4MaxnumberofconversionsUint16rsvd1:9;//15:7reserved};structADCTRL3_BITS{//bitsdescriptionUint16SMODE_SEL:1;//0SamplingmodeselectUint16ADCCLKPS:4;//4:1ADCcoreclockdividerUint16ADCPWDN:1;//5ADCpowerdownUint16ADCBGRFDN:2;//7:6ADCbandgap/refpowerdownUint16rsvd1:8;//15:8reserved};structADCST_BITS{//bitsdescriptionUint16INT_SEQ1:1;//0SEQ1InterruptflagUint16INT_SEQ2:1;//1SEQ2InterruptflagUint16SEQ1_BSY:1;//2SEQ1busystatusUint16SEQ2_BSY:1;//3SEQ2busystatusUint16INT_SEQ1_CLR:1;//4SEQ1InterruptclearUint16INT_SEQ2_CLR:1;//5SEQ2InterruptclearUint16EOS_BUF1:1;//6Endofsequencebuffer1Uint16EOS_BUF2:1;//7Endofsequencebuffer2Uint16rsvd1:8;//15:8reserved};structADCREFSEL_BITS{//bitsdescriptionUint16rsvd1:14;//13:0reservedUint16REF_SEL:2;//15:14Referenceselect};structADCOFFTRIM_BITS{//bitsdescriptionint16OFFSET_TRIM:9;//8:0OffsetTrimUint16rsvd1:7;//15:9reserved};//ConfigureADCAdcRegs.ADCMAXCONV.all=0x0000;//Setup1conv'sonSEQ1AdcRegs.ADCCHSELSEQ1.bit.CONV00=0x0;//SetupADCINA0as1stSEQ1conv.AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1=1;//EnableSOCAfromePWMtostartSEQ1AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1=1;//EnableSEQ1interrupt(everyEOS)//AssumesePWM1clockisalreadyenabledinInitSysCtrl();EPwm1Regs.ETSEL.bit.SOCAEN=1;//EnableSOConAgroupEPwm1Regs.ETSEL.bit.SOCASEL=4;//SelectSOCfromfromCPMAonupcountEPwm1Regs.ETPS.bit.SOCAPRD=1;//Generatepulseon1steventEPwm1Regs.CMPA.half.CMPA=0x0080;//SetcompareAvalueEPwm1Regs.TBPRD=0xFFFF;//SetperiodforePWM1EPwm1Regs.TBCTL.bit.CTRMODE=0;//countupandstartExamplecodeSETUPADCoperatingmodeStart-stopmodeContinuousconversionmodeDual-sequencermodeCascadedmodeSequentialsamplingSimultaneoussamplingCascadedmodeDual-sequencermodeSequentialsamplingSequentialsamplingSequentialsamplingSimultaneoussamplingSimultaneoussamplingSimultaneoussamplingAdcRegs.ADCTRL1.bit.SEQ_CASC=1;AdcRegs.ADCTRL3.bit.SMODE_SEL=0;AdcRegs.MAX_CONV.all=0x000F;AdcRegs.ADCCHSELSEQ1.bit.CONV00=0x0;AdcRegs.ADCCHSELSEQ1.bit.CONV01=0x1;AdcRegs.ADCCHSELSEQ1.bit.CONV02=0x2;AdcRegs.ADCCHSELSEQ1.bit.CONV03=0x3;AdcRegs.ADCCHSELSEQ2.bit.CONV04=0x4;AdcRegs.ADCCHSELSEQ2.bit.CONV05=0x5;AdcRegs.ADCCHSELSEQ2.bit.CONV06=0x6;AdcRegs.ADCCHSELSEQ2.bit.CONV07=0x7;AdcRegs.ADCCHSELSEQ3.bit.CONV08=0x8;AdcRegs.ADCCHSELSEQ3.bit.CONV09=0x9;AdcRegs.ADCCHSELSEQ3.bit.CONV10=0xA;AdcRegs.ADCCHSELSEQ3.bit.CONV11=0xB;AdcRegs.ADCCHSELSEQ4.bit.CONV12=0xC;AdcRegs.ADCCHSELSEQ4.bit.CONV13=0xD;AdcRegs.ADCCHSELSEQ4.bit.CONV14=0xE;AdcRegs.ADCCHSELSEQ4.bit.CONV15=0xF;ADCINA0---ADCRESULT0ADCINA1---ADCRESULT1ADCINA2---ADCRESUL
本文标题:dsp28335ADC模块讲解
链接地址:https://www.777doc.com/doc-5678509 .html