DSP28335教程7專業(yè)知識講座_第1頁
DSP28335教程7專業(yè)知識講座_第2頁
DSP28335教程7專業(yè)知識講座_第3頁
DSP28335教程7專業(yè)知識講座_第4頁
DSP28335教程7專業(yè)知識講座_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

Analog-to-DigitalConverterModule6TMS320C28x?MCUWorkshopCopyright?2023TexasInstruments.Allrightsreserved.

TechnicalTrainingOrganizationT

TO第1頁LearningObjectivesUnderstandtheoperationoftheAnalog-to-Digitalconverter(ADC)UsetheADCtoperformdataacquisition第2頁ADCModuleBlockDiagram(CascadedMode)12-bitA/DConverterSOCEOCSoftwareADCINA0ADCINA1ADCINA7ADCINB0ADCINB1ADCINB7S/HAS/HBMUXMUXARESULT0RESULT1RESULT2RESULT15ResultMUXExternalPin(GPIO/XINT2_ADCSOC)ePWM_SOC_AePWM_SOC_BMUXBChSel(CONV00)ChSel(CONV01)ChSel(CONV02)ChSel(CONV03)ChSel(CONV15)MAX_CONV1AutosequencerStartSequenceTriggerSEQ1ADCfull-scaleinputrangeis0to3V第3頁ADCModuleBlockDiagram(Dual-Sequencermode)RESULT8RESULT9RESULT15ResultMUXRESULT0RESULT1RESULT7ResultMUX12-bitA/DConverterS/HAS/HBMUXSoftwareePWM_SOC_AExternalPinSOC1/EOC1SequencerArbiterSOC2/EOC2SoftwareePWM_SOC_BADCINA0ADCINA1ADCINA7ADCINB0ADCINB1ADCINB7MUXAMUXBMUXMUXChSel(CONV00)ChSel(CONV01)ChSel(CONV07)MAX_CONV1AutosequencerStartSequenceTriggerSEQ1(GPIO/XINT2_ADCSOC)ChSel(CONV08)ChSel(CONV09)ChSel(CONV15)MAX_CONV2AutosequencerStartSequenceTriggerSEQ2ADCfull-scaleinputrangeis0to3V第4頁ADCOperatingModeChoicesTheusercanmakeonechoicefromeachcategorybelowChoicesarecompletelyindependent*SequencerModeCascadedDualSamplingModeSequentialSimultaneousRunModeStart/StopContinuous* NotethatusingContinuousRunmodewithDualSequencergenerallydoesn’tmakesensesincesequencer#2willnotgettodoanyconversions!第5頁ADCClockingFlowCLKIN(30MHz)HSPCLK(150MHz)ADCCLKPSbitsADCTRL30110bFCLK(12.5MHz)FCLK=HSPCLK/(2*ADCCLKPS)ADCCLK=FCLK/(CPS+1)ADCCLK(12.5MHz)CPSbitADCTRL10bToADCpipelinesamplingwindowACQ_PSbitsADCTRL10111bNote: MaximumF2833xADCCLKis25MHz,butINL(integralnonlinearityerror)isgreater above12.5MHz.Seethedevicedatasheetformoreinformation.SYSCLKOUT(150MHz)PLLSTSDIVSELbits10b

(/2)ToCPUsamplingwindow=(ACQ_PS+1)*(1/ADCCLK)PCLKCR0.ADCENCLK=1HISPCPHSPCLKbits000b(/1)PLLCRDIVbits1010b

(x10)第6頁Analog-to-DigitalConverterRegisters

AdcRegs.register(labfile:Adc.c)ADCTRL1 ADCControlRegister1ADCTRL2 ADCControlRegister2ADCTRL3 ADCControlRegister3ADCMAXCONV ADCMaximumConversionChannelsRegisterADCCHSELSEQ1 ADCChannelSelectSequencingControlRegister1ADCCHSELSEQ2 ADCChannelSelectSequencingControlRegister2ADCCHSELSEQ3 ADCChannelSelectSequencingControlRegister3ADCCHSELSEQ4 ADCChannelSelectSequencingControlRegister4ADCASEQSR ADCAutosequenceStatusRegisterADCRESULT0 ADCConversionResultBufferRegister0ADCRESULT1 ADCConversionResultBufferRegister1ADCRESULT2 ADCConversionResultBufferRegister2

ADCRESULT14 ADCConversionResultBufferRegister14ADCRESULT15 ADCConversionResultBufferRegister15ADCREFSEL ADCReferenceSelectRegisterADCOFFTRIM ADCOffsetTrimRegisterADCST ADCStatusandFlagRegisterRegister Description第7頁ADCControlRegister1

AdcRegs.ADCTRL1EmulationSuspendMode00=freerun(donotstop)01=stopaftercurrentsequence10=stopaftercurrentconversion11=stopimmediatelyADCModuleReset0=noeffect1=reset(setbackto0byADClogic)AcquisitionTimePrescale(S/H)ACQWindow=(ACQ_PS+1)*(1/ADCCLK)SUSMODACQ_PSCPS7RESET15reserved11-813-1214ConversionPrescale0:ADCCLK=FCLK/11:ADCCLK=FCLK/2UpperRegister:第8頁ADCControlRegister1

AdcRegs.ADCTRL1SequencerMode0=dualmode1=cascadedmodeContinuousRun0=stopsafterreachingendofsequence1=continuous(startsalloveragainfrom“initialstate”)SequencerOverride(functionsonlyifCONT_RUN=1)0=sequencerpointerresetsto“initialstate”atendofMAX_CONVn1=sequencerpointerresetsto“initialstate”after“endstate”SEQ_OVRDSEQ_CASC3-0CONT_RUNreserved456LowerRegister:第9頁ADCControlRegister2

AdcRegs.ADCTRL2InterruptEnable(SEQ1)0=interruptdisable1=interruptenableePWMSOCB(cascadedmodeonly)0=noaction1=startbyePWMsignalResetSEQ10=noaction1=immediateresetSEQ1to“initialstate”StartConversion(SEQ1)0=clearpendingSOCtrigger1=softwaretrigger-startSEQ1ePWMSOCASEQ1MaskBit0=cannotbestartedbyePWMtrigger1=canbestartedbyePWMtriggerInterruptMode(SEQ1)0=interrupteveryEOS1=interrupteveryotherEOSRST_SEQ19ePWM_SOCB_SEQ12reserved1115SOC_SEQ1INT_ENA_SEQ1INT_MOD_SEQ1reservedePWM_SOCA_SEQ18141310UpperRegister:第10頁ADCControlRegister2

AdcRegs.ADCTRL2InterruptEnable(SEQ2)0=interruptdisable1=interruptenableExternalSOC(SEQ1)0=noaction1=startbysignalfromADCSOCpinStartConversion(SEQ2)(dual-sequencermodeonly)0=clearpendingSOCtrigger1=softwaretrigger-startSEQ2ePWMSOCBSEQ2MaskBit0=cannotbestartedbyePWMtrigger1=canbestartedbyePWMtriggerInterruptMode(SEQ2)0=interrupteveryEOS1=interrupteveryotherEOSRST_SEQ21EXT_SOC_SEQ14reserved37SOC_SEQ2INT_ENA_SEQ2INT_MOD_SEQ2reservedePWM_SOCB_SEQ20652LowerRegister:ResetSEQ20=noaction1=immediateresetSEQ2to“initialstate”第11頁ADCControlRegister3

AdcRegs.ADCTRL3SamplingModeSelect0=sequentialsamplingmode1=simultaneoussamplingmodeADCClockPrescale0 :FCLK=HSPCLK1toF :FCLK=HSPCLK/(2*ADCCLKPS)ADCBandgapandReferencePowerDown00=powereddown11=poweredupADCPowerDown(exceptBandgap&Ref.)0=powereddown1=poweredupADCBGRFDNADCCLKPSSMODE_SEL015-8reserved4-17-6ADCPWDN5第12頁MaximumConversionChannelsRegister

AdcRegs.ADCMAXCONVMAX_CONV2_2MAX_CONV2_1MAX_CONV2_0MAX_CONV1_3MAX_CONV1_2MAX_CONV1_1MAX_CONV1_0reservedCascadedModeDualModeSEQ2SEQ1Bitfieldsdefinethenumberofconversionspertrigger(binary+1)Eachsequencerstartsatthe“initialstate”andadvancessequentiallyEachwillwrapatthe“endstate”unlesssoftwareresetsitsooner SEQ1 SEQ2 CascadedInitialstate CONV00 CONV08 CONV00Endstate CONV07 CONV15 CON7第13頁ADCInputChannelSelectSequencingControlRegisters

AdcRegs.ADCCHSELSEQxADCCHSELSEQ115-1211-87-43-0CONV03CONV02CONV01CONV00ADCCHSELSEQ2CONV07CONV06CONV05CONV04ADCCHSELSEQ3CONV11CONV10CONV09CONV08ADCCHSELSEQ4CONV15CONV14CONV13CONV12Forpurposesoftheseregisters,channelnumbersare:0=ADCINA0 8=ADCINB07=ADCINA7 15=ADCINB7第14頁Example-SequencerConfiguration(1of2)ConfigurationRequirements:ePWMtriggerstheADCThreeautoconversions(V1,V2,V3)offtrigger1(CTR=0)Threeautoconversions(I1,I2,I3)offtrigger2(CTR=PRD)ADCincascadedsequencerandsequentialsamplingmodesV1,V2,V3I1,I2,I3V1,V2,V3I1,I2,I3ePWMTimeBaseCounter

ePWMOutput第15頁Example-SequencerConfiguration(2of2)

Bits

15-1211-87-43-0 I1V3V2V1 ADCCHSELSEQ1 xxI3I2 ADCCHSELSEQ2RESULT0V1RESULT1V2RESULT2V3RESULT3I1RESULT4I2RESULT5I3MAX_CONV1issetto2andChannelSelectSequencingControlRegistersaresetto:Onceresetandinitialized,SEQ1waitsforatriggerFirsttrigger,threeconversionsperformed:CONV00(V1),CONV01(V2),CONV02(V3)MAX_CONV1valueisresetto2(unlesschangedbysoftware)SEQ1waitsforsecondtriggerSecondtrigger,threeconversionsperformed:CONV03(I1),CONV04(I2),CONV05(I3)Endofsecondsequence,ADCResultsregistershavethefollowingvalues:SEQ1waitsatcurrentstateforanothertriggerUsercanresetSEQ1bysoftwaretostateCONV00andrepeatsametrigger1,2session第16頁ADCConversionResultRegistersLSBMSB15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0LSBMSB15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0AdcRegs.ADCRESULTx,x=0-15 (2wait-stateread)Input Digital AdcRegs. AdcMirror.Voltage Result ADCRESULTx ADCRESULTx3.0 FFFh 1111|1111|1111|0000 0000|1111|1111|11111.5 7FFh 0111|1111|1111|0000 0000|0111|1111|11110.00073 1h 0000|0000|0001|0000 0000|0000|0000|00010 0h 0000|0000|0000|0000 0000|0000|0000|0000AdcMirror.ADCRESULTx,x=0-15 (1wait-stateread)第17頁HowCanWeHandleSignedInputVoltages?Example:-1.5V

Vin

+1.5V1)Add1.5voltstotheanaloginputVin1.5VADCINxGNDADCLO-+RRR-+RRC28x#include“DSP2833x_Device.h”#defineoffset0x07FFvoidmain(void){

int16value; //signedvalue=AdcMirror.ADCRESULT0–offset;}2)Subtract“1.5”fromthedigitalresult第18頁Built-InADCCalibrationTIreservedOTPcontainsdevicespecificADCcalibrationdata(2words)TheBootROMcontainsanADC_cal()routine(6words)thatcopiesthecalibrationdatatotheADCREFSELandADCOFFTRIMregistersADC_cal()mustberuntomeettheADCspecsinthedatasheetTheBootloaderautomaticallycallsADC_cal()suchthatnoactionisnormallyrequiredbytheuserIfthebootloaderisbypassed(e.g.,duringdevelopment)ADC_cal()shouldbecalledbytheapplication:#defineADC_cal_func_ptr(void(*)(void))0x380080voidmain(void){(*ADC_cal_func_ptr)();//callADC_cal()}第19頁Iftheoffsetandgainerrorsinthedatasheet*areunacceptableforyourapplication,oryouwanttoalsocompensateforboardlevelerrors(e.g.,sensororamplifieroffset),youcanmanuallycalibrateOffseterrorCompensatedinanalogwiththeADCOFFTRIMregisterNoreductioninfull-scalerangeGroundaninputpin,setADCOFFTRIMtomaximumoffseterror,andtakeareadingRe-adjustADCOFFTRIMtomakeresultzeroGainerrorCompensatedinsoftwareSomelossinfull-scalerangeRequiresuseofasecondADCinputpinandanupper-rangereferencevoltageonthatpin;see“TMS320280xandTMS320F2801xADCCalibration”appnote#SPRAAD8formoreinformationTip:Tominimizemux-to-muxvariationeffects,putyourmostcriticalsignalsonasinglemuxandusethatmuxforcalibrationinputsManualADCCalibrationADCOFFTRIMCHCH12-bitA/DConverterMUX*+/-15LSBoffset,+/-30LSBgain.Seedevicedatasheetforexactspecifications第20頁ADCReferenceSelection

AdcRegs.ADCREFSELTheF28335ADChasaninternalreferencewithtemperaturestabilityof~50PPM/°C*Ifthisisnotsufficientforyourapplication,thereistheoptiontouseanexternalreference*Externalreferencechoices:2.048V,1.5V,1.024VThereferencevalueDOESNOTchangethe0-3Vfull-scal

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論