欢迎来到天天文库
浏览记录
ID:26599864
大小:91.00 KB
页数:24页
时间:2018-11-27
《基于fpga相位差测量模块设计》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、基于FPGA的相位差测量模块的设计相位差测量设计思路相位差测量设计要求基于FPGA设计一个测量两路同频率信号相位差的模块,具体要求如下:测量信号频率范围:20Hz~20kHz,精度:2度,测量波形:方波。自行设计相位差可控双路输出脉冲源作为被测对象。发挥部分:(1)相位差和频率交替显示或同时显示(2)提高测量精度(3)拓宽频率范围到20Hz~200kHz(4)设计出一套相位计前置整形电路方案(采用模拟电路或者模数混合,仅设计和仿真,不制作),要求能自适应峰峰值在0.2V至5伏的非方波输入信号,尽量减少两路输入信号幅度不一致引入的误差,带宽不小于20Hz~20kHz,输出信号能接
2、入本课题设计的相位差测量模块。相位差测量设计方案根据题目要求,我们组把这个模块的设计分为四个子模块,分别为:信号源的发生、频率计的设计、相位差的测量和四位LED相位差显示。信号源的发生产生两路同频、相位差可控的信号;频率计的设计是借用信号源产生的信号,然后根据内部晶振产生闸门宽度为1秒的闸门信号,在高电平时开始计数,记得的周期个数,即信号源产生信号的频率;相位差的测量是先通过测量两路信号的上升沿之间内部晶振的周期数,然后由此周期数换算出相位差,再通过VHDL语言内部函数转换成十进制数输出到显示模块。RTL图如下:模块程序LIBRARYIEEE;USEIEEE.STD_LOGIC
3、_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYkzysISPORT(CLK:INSTD_LOGIC;KG:INSTD_LOGIC;ZS:INNATURAL;KG_OUT:OUTSTD_LOGIC);ENDentitykzys;ARCHITECTUREoneOFkzysISSIGNALCNT:NATURAL;BEGINPROCESS(KG,CLK)BEGINIFKG='0'THENCNT<=0;KG_OUT<='0';ELSIFCLK'EVENTANDCLK='1'THENIFCNT4、OUT<='1';ENDIF;ENDIF;ENDPROCESS;END;libraryieee;useieee.std_logic_1164.all;entityxhkisport(sw_1:instd_logic_vector(4downto0);f_out1:outnatural;y_out2:outnatural);endxhk;architectureoneofxhkisbeginprocess(sw_1)begincasesw_1iswhen"00001"=>f_out1<=499999;y_out2<=277778;when"00010"=>f_out1<=49995、99;y_out2<=625000;when"00011"=>f_out1<=499999;y_out2<=1666667;when"00100"=>f_out1<=6666;y_out2<=5556;when"00101"=>f_out1<=6666;y_out2<=11111;when"00110"=>f_out1<=6666;y_out2<=16667;when"00111"=>f_out1<=499;y_out2<=1806;when"01000"=>f_out1<=499;y_out2<=1667;when"01001"=>f_out1<=499;y_out2<=626、5;when"01010"=>f_out1<=82;y_out2<=174;when"01011"=>f_out1<=82;y_out2<=81;when"01100"=>f_out1<=82;y_out2<=220;when"01101"=>f_out1<=49;y_out2<=32;when"01110"=>f_out1<=49;y_out2<=65;when"01111"=>f_out1<=49;y_out2<=122;when"10000"=>f_out1<=0;y_out2<=0;whenothers=>f_out1<=0;y_out2<=0;endcase;endp7、rocess;end;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYplfsqISPORT(clk:INSTD_LOGIC;ZS:INNATURAL;KG:INSTD_LOGIC;F_OUT:OUTSTD_LOGIC);END;ARCHITECTUREoneOFplfsqISSIGNALFULL:STD_LOGIC;BEGINPROCESS(clk)VARIABLECNT8:NATURA
4、OUT<='1';ENDIF;ENDIF;ENDPROCESS;END;libraryieee;useieee.std_logic_1164.all;entityxhkisport(sw_1:instd_logic_vector(4downto0);f_out1:outnatural;y_out2:outnatural);endxhk;architectureoneofxhkisbeginprocess(sw_1)begincasesw_1iswhen"00001"=>f_out1<=499999;y_out2<=277778;when"00010"=>f_out1<=4999
5、99;y_out2<=625000;when"00011"=>f_out1<=499999;y_out2<=1666667;when"00100"=>f_out1<=6666;y_out2<=5556;when"00101"=>f_out1<=6666;y_out2<=11111;when"00110"=>f_out1<=6666;y_out2<=16667;when"00111"=>f_out1<=499;y_out2<=1806;when"01000"=>f_out1<=499;y_out2<=1667;when"01001"=>f_out1<=499;y_out2<=62
6、5;when"01010"=>f_out1<=82;y_out2<=174;when"01011"=>f_out1<=82;y_out2<=81;when"01100"=>f_out1<=82;y_out2<=220;when"01101"=>f_out1<=49;y_out2<=32;when"01110"=>f_out1<=49;y_out2<=65;when"01111"=>f_out1<=49;y_out2<=122;when"10000"=>f_out1<=0;y_out2<=0;whenothers=>f_out1<=0;y_out2<=0;endcase;endp
7、rocess;end;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYplfsqISPORT(clk:INSTD_LOGIC;ZS:INNATURAL;KG:INSTD_LOGIC;F_OUT:OUTSTD_LOGIC);END;ARCHITECTUREoneOFplfsqISSIGNALFULL:STD_LOGIC;BEGINPROCESS(clk)VARIABLECNT8:NATURA
此文档下载收益归作者所有