频率计设计报告指导老师:陆继庆所属学院:电子工程学院制作日期:2010-5-142频率计分析报告摘要本设计系统采用MCS251系列单片机89C52作为控制核心,分测量输入信号的频率、幅度、极性三大模块设计电路,测量时,将被测输入信号经过相应处理后送给单片机,通过程序控制计数等,驱动LED数码管显示频率值、显示输入信号幅值及极性。该频率计采用测周期和测频组合法实现对输入信号的频率测量提高了测量精度,用相应比较器、芯片及分频器辅助单片机系统完成所要求的功能。通过测量结果对比,分析了测量误差的来源,提出了减小误差应采取的措施。频率计具有电路结构简单、成本低、测量方便、精度较高等特点,适合测量低频信号。关键词:单片机;数字频率计;测频、测幅、测极性FrequencycounteranalysisAbstractThedesignofthesystembyMCS251SeriesMCU89C52asthecontrol,themeasuringoftheinputsignalfrequency,amplitude,polarityofthethreemoduledesigncircuits,measurements,themeasuredinputsignalaftertheappropriatetreatmentgivenmicrocontroller,programmedtocounting,drivingLEDdigitaldisplayfrequencyvalues,showstheinputsignalamplitudeandpolarity.Theuseoftestcycleandfrequencymetermeasuringfrequencycombinationmethodtoachievetheinputsignalfrequencymeasurementimprovesmeasurementaccuracycomparedwiththecorrespondingdevice,chipanddividertocompletetherequiredsupportingsinglechipsystemfeatures.Bymeasuringtheresultsofcomparativeanalysisofthesourcesofmeasurementerror,proposedmeasurestobetakentoreducetheerrors.FrequencyMeterfeaturessimplestructure,lowcost,measurement,higheraccuracy,etc.,suitableformeasuringlowfrequencysignals.Keywords:microcontroller;digitalfrequencymeter;measurementfrequency,;measuredamplitude;polaritytest3目录一、系统整体方案设计………………………………………………………………………………..41.主要单元方案论证与比较..................................................................................................................4.................................................................................................................................................................52.总体方案设计....................................................................................................................................7二、主要单元模块设计及分析.....................................................................................................................71.各单元模块功能介绍及电路设计...................................................................................................72.电路参数的计算及元器件的选择:..............................................................................................103.特殊器件的介绍:.............................................................................................................................104.各单元模块的联接..........................................................................................................................12三、软件设计与分析...................................................................................................................................121.总体流程图........................................................................................................................................122.频率计测频部分................................................................................................................................133、频率计的测幅部分.........................................................................................................................144频率计的极性测量部分....................................................................................................................155.频率计的按键控制部分....................................................................................................................16四、测试仪器与系统测试结果分析...........................................................................................................161.测试仪器............................................................................................................................................162.测试方法............................................................................................................................................163.系统测试结果与分析........................................................................................................................174.误差分析:......................................................................................................................................185.系统功能及指标数分析....................................................................................................................18五、设计总结及体会...................................................................................................................................19六、参考文献...............................................................................................................................................194一、系统整体方案设计1.主要单元方案论证与比较本设计为一自适应数字频率计,可以自动判别输入周期频率信号(5Hz-10k)的特性(单极性或双极性信号、信号的频率、信号幅度)。输入信号:正弦波、方波(单极性或双极性),三角波、锯齿波、正向输入峰值(0.5-5v)。要求:频率测量误差小于1%(频率测量低频采用计时,高频采用计数),用4位数码显示,自动切换显示小数点及显示单位;幅度测量误差小于10%.自动切换显示小数点及显示单位。分析题目可见,本设计主要解决对输入信号频率、幅度和极性测量三个主要问题。以下的方案论证也据此展开。(1).测频电路的方案选择方案一:采用频率计模块(如ICM7216)构成,特点是结构简单,量程可以自动切换。(如图1.1.1所示)图1.1.1采用频率计模块构成原理框图ICM7216内部带有放大整形电路,可以直接输入模拟信号。外部振荡部分选用一块高精度晶振体和两个低温系数电容构成10MHz并联振荡电路。用转换开关选择10ms,011s,1s,10s四种闸门时间,同时量程自动切换,直接点亮LED。方案二:直接测频法。系统采用可编程逻辑器件(PLD,如ATV2500)作为信号处理及系统控制核心,完成包括计数、门控、显示等一系列工作。该方案利用了PLD的可编程和大规模集成的特点,使电路大为简化,但此题使用PLD则不能充分发挥其特点及优势,并且测量精度不够高,导致系统性能价格比降低、系统功能扩展受到限制。方案三:系统采用MCS251系列单片机89C52作为控制核心,用比较器结合分频送入单片机测量。(见图1.1.2)图1.1.2测频原理框图(方案三)电压跟随器滤