版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精选优质文档-倾情为你奉上Design and Implementation ofDigital Cymometer Based on CPLDAbstractWith the adoption of the top-down design method and AT89C51 SCMC (Single Chip Mico Computer) as the master control component of the system ,the circuit test signalcontrolling ,data operation processing ,keyboard scanning
2、 ,and nixie tube display as well were completed by the digital cymometer.A CPLD ,EPM7128SLC84-15 ,programmed by VHDL ,realized various sequence control and count functions .The system is characterized by impact structure ,high reliability ,high precision ,and wide frequency-test-range . Keyword
3、s digital cymometer,complex programmable logic device,SCMC,EDA technology 1 IntroductionThe system core called SCMC (Single Chip Mico Computer) emerges constantly despite the unceasing development of electronic and computer technologies.The frequency measurement or cycle measurement is usually
4、utilized for testing signals that use frequency as a parameter. When the tested frequency is relatively high ,relatively high precision can be available with frequency measurement . When the tested frequency isrelatively low ,relatively high precision can be a vailable with cycle measurement . Howev
5、er , neither of them can ensure the measurement precision in the whole frequency range ,when the range of tested frequency is comparatively wide .This digital Cymometer utilizes the advanced EDA technology and top-down design method . Thus ,the Cynometer implements the equal precision measurement of
6、 the signal frequency range of 0.1 Hz50MHzby AT89C51 SCMC and CPLD,and also measures pulse width and duty ratio . Because of the convenience of CPLD programming ,quick speed , high integration , and low price , the system research circle is extremelyshortened and the product ratio of performance ver
7、sus price is improved . The CPLD chip employs the popular VHDL and achieves all the program design and Download on the MAX+PlusII software platform . The control portion of SCMC ,programmed by assemble language precisely sets time , exactly controls startup and closedown of frequency-test count stro
8、be ,which further ensures measurement precision . System theory and software & hardware design are introduced below .2 Equal precision measurement theoryIn CPLD ,top-level circuit structure realized by VHDL is shown in figure 1 ,where CONTROL1 is control module of frequency-est ,CONTROL2 is cont
9、rol module of pulse-width-test and duty ratio,CHOICE is choice module of self-djustment and measurement ;COUNT is count module of datum frequency and frequency-test . Under the control of SCMC ,the CPLD accomplishes frequency-test in the following steps :(a) Plus pulse signal is added at CLR , there
10、by completing the initialization of testing circuit state (when frequency is tested ,CS ,AS is low ,ED2 is irrelevant ) .(b) When strobe signal STROBE is set high ,timing starts . Meanwhile ,rising edge of pulse-test signal Fx ,which is selected by CHOICE module , initiates frequency-test control mo
11、dule CONTROL1 , which makes two sets of 32-bit counter within COUNT take count of datum frequency signal Fs and signal-test Fx synchro no usly .(c) STROBE is set low when stro be timing ends . COUNT stops counting once rising edge of next pulse of signal-test advents .(d) After count finishes ,ED1 o
12、utputs low level to apply for interrupt from SCMC. In the Interrupt Service Routine ,SCMC reads count value of datum frequency signal and signal-test in COUNT from port P0 and P2 of SCMC for four times , through encoding address line SS1 and SS0 . If the count value of signal-test is Nx ,datum frequ
13、encys is Ns ,then Fx=( Fs/ N s) N x . Fig . 1 Frequency measurement top-level module3 Design of system hardware circuitThe block diagram of system hardware circuit is shown in f igure 2 .There is a 4 kB Flash Memory in A T89C51 SCMC into which all control program can be stored . SCMC writes the resu
14、lt tested from CPLD each time into RAM ,and t hen sends it in decimal into eight-bit nixie tube display circuit to display after operation processing . Keyboard control command is written into SCMC via a 74LS165 ,Parallel in/ Serial Output Shift Registers . SCMC utilizes one 12MHz crystal whose osci
15、lla-tion pulse is served as self-adjustment input of CPLD at the same time . Signal-test is inputted to CPLD via wide band amplify and Schmitt circuit shape . 50MHz active crystal module is used for datum frequency input . 4 VHDL program designCPLD software program is achieved by VHDL . A porti
16、on of top-level module program is as follow :LIBRARY IEEE ;USE IEEE. STD_LOGIC_1164 . ALL ;USE IEEE. STD_LOGIC_UNSIGNED . ALL ;ENTITY FREQUENCY8 ISPORT ( SS0 ,SS1 ,FS ,FX ,FC ,CLR ,AS ,STROBE ,CS : IN STD_LOGIC ;ED1 , ED2 :OUT STD_LOGIC ;B :OUT STD_LOGIC_VECTOR (15 DOWNTO 0) ) ;END FREQUENCY8 ;ARCHI
17、TECTURE RTL OF FREQUENCY8 ISSIGNAL FX0 ,CLKX ,CLKS ,CLE ,SSL1 : STD_LOGIC ;COMPONENT COUNTPORT ( FX1 ,FS1 ,CLR ,SS0 ,SS1 : IN STD_LOGIC ;B :OUT STD_LOGIC_VECTOR (15 DOWNTO 0) ) ;END COMPONENT ;BEGINU1 :CHOICE PORT MAP ( FX => FX ,FC => FC ,AS =>AS ,FOUT =>FX0) ;U2 :CONTROL1 PORT MAP( FX1
18、=>FX0 , STROBE =>STROBE ,CLR=>CLR , FS=>FS ,CS =>CS ,SSL=>SSL1 ,CLK1=>CLKX ,CLK2 =>CLKS ,CLRC =>CLE ,ED1 => ED1) ;U3 :CONTROL2 PORT MAP( FIN=>FX0 ,STROBE => STROBE ,CLR=>CLR ,SSL=>SSL 1 ,ED2=>ED2) ;U4 :COUNT PORT MAP(FX1=>CLKX ,FS1=>CLKS ,CLR=>CL
19、E ,SS0 = > SS0 ,SS1 = > SS1 ,B = > B) ;END RTL ;Figure 3 is the emulation waveform diagram when signal-test Fx=10MHz and Fs=50MHz .Fig . 2 Emulation waveform diagram5 Frequency-test precision analysisFrom the frequency-test formula : Fx = (Fs/ Ns) Nx . Suppose that frequency-test is Fx ,its
20、 true value is Fxe ,and standard frequency is Fs. In one measurement ,because Fx count startup and closedown time are both triggered by the signals rising edge ,count Nx of Fx has no error in one strobe time T ,while count Ns has error of one pulse at most , that is | et | 1 , we can derived Fxe =(
21、Fs/(N s +et) ) Nx fromFx/Nx = Fs/Ns and Fxe/Nx = Fs/(Ns +et ) . According to relative error formula Fxe/ Fxe =| Fxe -Fx | /Fxe ,we have Fxe/ Fxe = |et| /Ns. Then , since | et | 1 , we obtain | et | / N s 1/ Ns ,Ns = TFs.Accordingly we reach the conclusion that relative measurement error has no relat
22、ion to frequency-test ,measurement error which can be reduced and measurement precision improved via augmenting strobe time T or enhancing Fs. The measurement precision of frequency-test system remains constant in the entire frequency range in case that strobe time and general frequency measurement
23、strobe time is uniform and signal-test frequency is dissimilar .The range of this system frequency-test is set as from 0.1Hz to 50MHz . Strobe time is set to two grades :1s and 10s . The strobe can test and obtain signal once every 10s when frequency-test is 0.1Hz .50MHz upper limit frequency settin
24、g depends on such factors as internal counter digit of CPLD , CPLD clock ,nixie tube digit ,and so on . In 10s strobe time ,50MHz datum frequency can count 500MHz pulse(only 29 bits binary number required) ,while 400MHz can be counted in theory as the 32-bit of signal-test is fully used in 10s . How
25、ever ,because it is limited by two sets of global count clock ,which is 151.5MHz at most ,in EPM7128SLC84-15 chip selected by the system and the digit of 8-bit nixie tube , the upper limit frequency is restricted within 50MHz . In that case ,frequency-test whole-range relative error is millionth con
26、stantly .References :1 Song Pan , Guodong Wang . VHDL Application Course M . Chengdu :U niversity of Electronic Science and Technology Press ,2000 .2 Wanjie Song ,Ping Luo ,Shunjun Wu . CPLD Technology and Application M . Xian :Xian University of Electronic Science and Technology Press ,2000 .3 Bo h
27、eng Hou ,Xin Gu . VHDL Hardware Description Language and Digital Logic Circuit Design M . Xian : Xian University of Electronic Science and Technology Press ,2001 .基于复杂可编程逻辑器件的数字频率计的设计与实现摘要采用自上向下的设计方法,设计了基于复杂可编程逻辑器件的数字频率计。以AT89C51单片机作为系统的主控部件,完成电路的测试信号控制、数据运算处理、键盘扫描和控制数码管显示。用VHDL语言编程 ,由CPLD (Complex
28、Programmable Logic Device) EPM7128SLC84-15 完成各种时序控制及计数功能。 该系统具有结构紧凑、可靠性高、测频范围宽和精度高等特点。关键词 数字频率计,逻辑器件,单片机,EDA 技术1引言随着电子技术与计算机技术的不断发展,以单片机为核心的测量控制系统层出不穷。对于以频率为参数的被测信号,通常多采用的是测频法或测周法。当被测频率较高时,采用测频法可以得到较高的测频精度;当被测频率较低时,采用测周法可以得到较高的测频精度。但当被测频率变化范围较大时,这两种方法均不能保证整个频率范围的测量精度。该测频系统的设计扬弃了传统的自下而上的数字电路设计方法,采用先进
29、的EDA技术及自上而下的设计,把资源丰富、控制灵活及良好人机对话功能的AT89C51单片机和具有内部结构重组、现场可编程的CPLD芯片完美的相结合起来,实现了对0.1Hz-50MHz信号频率的等精度测量。由于CPLD具有连续连接结构,易于预测延时,使电路仿真会更加准确,且编程方便,速度快,集成度高,价格低,从而使系统研制周期大大缩短,产品的性能价格比捉高。CPLD芯片采用流行的VHDL语言编程,并在MAX+plus设计平台上实现了全部编程设计,单片机采用底层汇编语言编程,可以精确地控制测频计数闸门的开启和关闭,从而进一步提高了测量精度。该数字频率计的设计及实现具有良好的应用价值和推广前景。下面
30、对系统的软硬件设计进行详细论述。 2. 等精度测量原理CPLD利用VHDL语言实现的测频顶层电路模块逻辑结构如图1所示,其中CONTROL1为测频或测周期控制模块;CONTROL2为测脉宽和占空比控制模块;CHOICE为自校与测量选择模块;COUNT为基准频率和被测频率计数器模块。在单片机的控制下,CPLD完成频率测量的步骤如下: (1)在CLR端加正脉冲信号完成侧试电路状态的初始化(当进行频率测量时,CS、AS为低电平,ED2 是不相干的)。 (2)由预置门控信号将STROBE置高电平,预置门开始定时,与此同时,被测脉冲信号FX经CHOICE选择后,启动频率测试控制模块CONTRO
31、L1, 被测信号的上升沿打开内含两套32位二进制计数器COUNT,同时对标准信号FS和被测信号FX进行计数。(3)顶置门定时结束信号把STROBE置为低电平,在被测信号的下一个脉冲的上沿到来时,COUNT停止计数。 (4)计数结束后,ED1端输出低电平来指示测量计数结束,单片机得到此信号后,即可利用SSO, SS1 进行选择,四次分别读回COUNT中基准频率信号和被测信号计数值。设FX为整形后的被测信号,FS为标准频率信号,若在一次预置门高电平脉宽时间内被狈1信号计数值为Nx,基准频率计数值为Ns,则有: Fx=(Fs/Ns)Nx 图1 测频顶层模块逻辑电路3. 系统的硬件电路设计系统的硬件电
32、路组成框图如图1-1所示。图中主控模块AT89C51是一个内含4K字节可编程可擦除的快闪存储器 (Flash Memory)的单片机。所有信号包括基准频率信号、被测信号以及自校输入信号均可在AT89C51单片机的控制下送入CPLD芯片中,单片机将每次测试结果读入内存RAM中,经运算处理后,以十进制的形式送到8位数码管显示电路显示。键盘控制命令通过一片74LS165并入串出移位寄存器读入单片机。单片机由外接12MHz标准晶振提供时钟电路,同时输入CPLD的自校频率也取自单片机的外接晶振。用50MHz的有源晶振作为测试标准频率。4. VHDL程序设计CPLD的软件部分由VHDL语言实现,其顶层模块
33、程序如下面所示:LIBRARY IEEE ;USE IEEE. STD_LOGIC_1164 . ALL ;USE IEEE. STD_LOGIC_UNSIGNED . ALL ;ENTITY FREQUENCY8 ISPORT ( SS0 ,SS1 ,FS ,FX ,FC ,CLR ,AS ,STROBE ,CS : IN STD_LOGIC ;ED1 , ED2 :OUT STD_LOGIC ;B :OUT STD_LOGIC_VECTOR (15 DOWNTO 0) ) ;END FREQUENCY8 ;ARCHITECTURE RTL OF FREQUENCY8 ISSIGNAL FX
34、0 ,CLKX ,CLKS ,CLE ,SSL1 : STD_LOGIC ;COMPONENT COUNTPORT ( FX1 ,FS1 ,CLR ,SS0 ,SS1 : IN STD_LOGIC ;B :OUT STD_LOGIC_VECTOR (15 DOWNTO 0) ) ;END COMPONENT ;BEGINU1 :CHOICE PORT MAP ( FX => FX ,FC => FC ,AS =>AS ,FOUT =>FX0) ;U2 :CONTROL1 PORT MAP( FX1=>FX0 , STROBE =>STROBE ,CLR=>CLR , FS=>FS ,CS =>CS ,SSL=>SSL1 ,CLK1=>CLKX ,CLK2 =>CLKS ,CLRC =>
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 福建省龙岩市一级校联盟2024-2025学年高二上学期11月期中联考数学试题 含解析
- 写刘慈欣的英语作文
- 红餐:云南米线发展报告2024
- 文书模板-清理旱厕服务合同
- 2024年04版小学三年级英语第五单元期中试卷
- 药理习题库(含答案)
- 信息不对称对企业的影响分析-职场实操
- 2024年电力控制设备项目投资申请报告代可行性研究报告
- 2024年户外广告行业项目资金申请报告代可行性研究报告
- 2024年空间环境监测系统项目投资申请报告代可行性研究报告
- 药物警戒内审检查记录表
- 一元一次不等式复习(公开课)
- 中国书法-英文 chinese calligraphy
- 基于核心素养的课程建构
- 大班社会领域《走进新疆》
- 运动安全与健康知到章节答案智慧树2023年浙江大学
- 全过程跟踪审计和结算审计服务方案技术标投标方案
- 煤矿掘进工培训教案
- 宾客服务经理工作职责
- star法则撰写自己成就故事
- 印刷包装基础知识培训
评论
0/150
提交评论