基于CPLD的频率测量计摘要本文主要论述了利用CPLD进行测频计数,单片机实施控制实现等精度频率计的设计过程。该频率计利用等精度的设计方法,克服了基于传统测频原理的频率计的测量精度随被测信号频率的下降而降低的缺点。等精度的测量方法不但具有较高的测量精度,而且在整个频率区域保持恒定的测试精度。该频率计利用CPLD来实现频率的测量计数。利用单片机完成整个测量电路的测试控制、数据处理和显示输出。本文详细论述了硬件电路的组成和单片机的软件控制流程。其中硬件电路包括键控制模块、显示模块、输入信号整形模块以及单片机和CPLD主控模块。设计器件采用Atmel公司的单片机AT89C51和Altera公司的MAX7000系列EPM7128SLC84-15芯片。键控制模块设置1个开始键和3个时间选择键,键值的读入采用一片74LS165来完成;显示模块用8只74LS164完成LED的串行显示;被测信号经限幅后由两级直接耦合放大器进行放大,再经施密特触发器整形后输入CPLD;标准频率采用40MHz有源晶振动实现;单片机软件用汇编语言编写,软件模块对应于硬件电路的每一个部分,还包括部分数据计算和转换模块。关键词:单片机,CPLD,频率计,测频,等精度THEDESIGNOFFREQUENCYMEASUREMENTBASEDONCPLDAbstractThereachpapermainlydiscussesthedesignprocessofequal-accuracyfrequencymeterthatusesCPLDtocountthefrequencymeasurementandfrequencymeterisalsocontroledbysinglechipcomputer.Thefrequencymetermakesuseofequal-accuracydesignthatcanovercomethedisadvantageoftraditionalmeasuringprinciple,whichprecisiondeclinesasmeasuredsignalfrequencydoes.Theequal-accuracymeasurementnotonlyhashighermeasuringprecision,butalsocankeepinvariablemeasuringprecisioninwholeareaoffrequency.ThisfrequencymeterusesCPLDtorealizethemeasuringcountoffrequency.Singlechipcomputercompletesthetestcontrol、dataprocessinganddisplayoutputofthesystem.Thisessaydiscussesthecomposeofhardwarecircuitandsoftwarecontrolflowofsinglechipcomputerindetail.Hardwarecircuitincludeskeycontrolmodule、displaymodule,plasticmoduleofinputsignal、singlechipcomputercontrolmoduleandCPLDmaincontrolmodule.ThefrequencymeteradoptssinglechipcomputerAT89C51ofAtmelcompanyandEPM7128SLC84-15ofAlteracompany.Keycontrolmodulehas1functionkeyand3timeselectionkey.Achip74LS165completesthekeyvalueinput.Displaymoduleuseseight74LS165storealizetheserialdisplayofLED.First,themeasuringsignalamplitudeislimited.Second,thesingleisamplifiedbytwoclassdirectcouplingamplifier.Finally,thesignalinputsCPLDafteritistrimedbySmittertrigger.Standardfrequencyis40MHz.Softwareprogramofsinglechipcomputeriswritedbyassemblylanguage.Someofsoftwareprogramiscorrespondedtoeveryhardwarepart,theothersincluddatacountandtransform.KeyWords:SCM;CPLD,Frequencymeter,Frequencymeasurement,Equal-precision目录第一章引言..............................................................................................................................1第二章测量原理及其设计内容..............................................................................................22.1测量原理......................................................................................................................22.2频率计的设计内容和意义..........................................................................................3第三章硬件电路设计..............................................................................................................63.1系统组成......................................................................................................................63.2测频模块的工作原理及设计..................................