基于fpga的波形发生器、频率计和数字电压表毕业设计内容摘要:
ck1=lock1,start=start,oe=oe,ale=ale,access1=access1, dd1=data1,dd2=data2,dd3=data3,dd4=data4,dd5=data5,dd6=data6)。 u2:lcd port map(reset=reset,clk=clk,d1=data1,d2=data2,d3=data3, d4=data4,d5=data5,d6=data6,data=data,lcdda=lcdda,lcdrw=lcdrw,lcden=lcden)。 end Behavioral。 ADC0809 驱动 library IEEE。 use。 use。 use。 entity ad is Port (clk,reset,eoc:in std_logic。 clk50mhz是外部 32MHZ 时钟信号 d:in std_logic_vector(7 downto 0)。 ADC0809 的 8 位转换数据输出 lock1,start,oe,ale:out std_logic。 access1:out std_logic_vector(2 downto 0)。 输出到 ADC0809的控制信号 dd1,dd2,dd3,dd4,dd5,dd6: out std_logic_vector(3 downto 0))。 最终输出信号 end ad。 architecture Behavioral of ad is signal lock: std_logic。 signal qq:std_logic_vector(7 downto 0)。 type state is (st0,st1,st2,st3)。 signal current_state1:state。 type states is (st0,st1,st2,st3,st4,st5,st6)。 定义 7 个状态子类型 signal state1,state2:states:=st0。 初始化 states signal reg:std_logic_vector(7 downto 0)。 signal clk10k: std_logic。 signal access2: std_logic_vector(2 downto 0)。 signal reg2,reg1,regg,reg3: integer range 255 downto 0。 signal oe1:std_logic。 type states1 is (st0,st1)。 signal states2:states1:=st0。 begin process(clk,reset) fen pin 5k variable t: integer range 2500 downto 0。 begin if reset=39。 039。 then t:=0。 clk10k=39。 039。 elsif rising_edge(clk) then t:=t+1。 if t=2500 then clk10k=39。 139。 t:=0。 else clk10k=39。 039。 end if。 end if。 end process。 pro1:process(state1,eoc,d) 进程 2,主控组合和时序进程,规定各个状态转换方式 begin case state1 is when st0=state2=st1。 ale=39。 039。 start=39。 039。 oe=39。 039。 oe1=39。 039。 when st1=state2=st2。 ale=39。 139。 start=39。 039。 oe=39。 039。 when st2=state2=st3。 ale=39。 039。 start=39。 139。 oe=39。 039。 when st3= ale=39。 039。 start=39。 039。 oe=39。 039。 if eoc=39。 139。 then state2=st3。 测试 eoc 的下降沿 else state2=st4。 end if。 when st4= ale=39。 039。 start=39。 039。 oe=39。 039。 测试 eoc 的上升沿, =1 表明转换结束 if eoc=39。 039。 then state2=st4。 继续等待 else state2=st5。 end if。 when st5=state2=st6。 ale=39。 039。 start=39。 039。 oe=39。 139。 when st6=state2=st0。 ale=39。 039。 start=39。 039。 oe=39。 139。 reg=d。 oe1=39。 139。 when others=state2=st0。 ale=39。 039。 start=39。 039。 oe=39。 039。 end case。 end process。 process(clk,lock) begin if clk39。 event and clk=39。 139。 then qq=qq+1。 if qq=01111111 then lock=39。 139。 state1=state2。 01111111 elsif qq01111111 then lock=39。 039。 end if。 end if。 end process。 pro2:process(clk10k,reset,access2) begin if reset=39。 039。 then access2=000。 elsif rising_edge(clk10k) then case states2 is when st0= if regg=reg3 then states2=st0。 else states2=st1。 end if。 when st1= access2=011。 when others=states2=st0。 end case。 case access2 is when 011 = if regg=127 then access2=010。 else reg2=regg。 end if。 reg3=regg。 when 010 =if regg=102 then access2=001。 else reg2=regg。 end if。 reg3=regg。 when 001= if regg=127 then access2=000。 else reg2=regg。 end if。 reg3=regg。 reg2=regg。 reg3=regg。 when 000 = when others =null。 end case。 end if。 access1=access2。 end process。 lock1=lock。 reg2=conv_integer(reg)。 十进制- BCD 码转换; process(clk10k) variable reg1 : integer range 0 to 800000。 variable d1,d2,d3,d4,d5,d6 : std_logic_vector(3 downto 0)。 begin access2=000。 if reset=39。 039。 then d1:=0000。 d2:=0000。 d3:=0000。 d4:=0000。 d5:=0000。 d6:=0000。 if clk10k39。 event and clk10k=39。 139。 then case current_state1 is when st0=access1=access2。 if oe1=39。 139。 then current_state1=st1。 end if。 when st1= case access1 is when 011 = reg1:=reg2*1961。 1960 when 010 = reg1:=reg2*980。 980 980 when 001 = reg1:=reg2*392。 392 392 reg1:=reg2*196。 196 when 000 = when others=null。 end case。 d1:=0000。 d2:=0000。 d3:=0000。 d4:=0000。 d5:=0000。 d6:=0000。 current_state1=st2。 when st2= if reg199999 then reg1:=reg1100000。 d1:=d1+1。 elsif reg19999 then reg1:=reg110000。 d2:=d2+1。 elsif reg1999 then reg1:=reg11000。 d3:=d3+1。 elsif reg199 then reg1:=reg1100。 d4:=d4+1。 elsif reg19 then reg1:=reg110。 d5:=d5+1。 elsif reg10 then reg1:=reg11。 d6:=d6+1。 else current_state1=st3。 end if。 when st3= access2=011。 dd1=d1。 dd2=d2。 dd3=d3。 dd4=d4。 dd5=d5。 dd6=d6。 current_state1=st0。 when others= current_state1=st0。 end case。 end if。 end if。 end process。 end Behavioral。 LCD 驱动 程序 library IEEE。 use。 use。 use。 Unment the following lines to use the declarations that are provided for instantiating Xilinx primitive ponents. library UNISIM。 use。 entity lcd is generic(N:integer:=5000。 delay:integer:=100)。 Port ( clk,reset: in std_logic。 d1,d2,d3,d4,d5,d6: in std_logic_vector(3 downto 0)。 lcdda : out std_logic。 lcdrw : out std_logic。 lcden : out std_logic。 data : inout std_logic_vector(7 downto 0) )。 end lcd。 architecture Behavioral of lcd is type state is (set_dlnf,clear_lcd,set_cursor,set_dcb,set_location_cgram,write_data_cgram,set_location,write_data, set_location2,wri。基于fpga的波形发生器、频率计和数字电压表毕业设计
相关推荐
FPGA/现场可编程门阵列 Complex Programmable logic DeviceCPLD 在 EDA 电子设计自动化 基础上的广泛应用 . 从本质上说 , 新的电子系统运转的物理机制又归回到原来的纯数字电路结构 ,但在更高层次上容纳了过去数字技术的优秀部分 ,扬弃了 MCU 系统的应用模式 ,却包括了 MCU的内部资源,使电子设计的技术操作和系统构成的整体发生质的飞跃
也不必关心最终设计实现的目标器件是什么; ( 4) VHDL 具有电路仿真与验证功能,可以保证设计的正确性,用户甚至不必编写如何测试相量 便可以进行源代码级的调试,而且设计者可以非常方便地比较各种方案之间的可行性及其优劣,不需做任何实际的电路实验; ( 5) VHDL 语言可以与工艺无关编程; ( 6) VHDL 语言标准、规范,易于共享和复用。 VHDL 语言的基本结构 VHDL
87[LRM87]。 1993 年 VHDL 重新修订,形成了新的标准,即 IEEE STD 1076— 1993[LRM93]。 从此以后,美国国防部实施新的技术标准,要求电子系 统开发商的合同文件一律采用 VHDL 文档。 即第一个官方 VHDL 标准得到推广、实施和普及。 它源于美国政府于 1980 年开始启动的超高速集成电路计划 ,VHDL 主要用于描述数字系统的结构,行为,功能和接口。
毕业设计题目是基于 FPGA 的无刷直流电动机控制器的设计,根据此题目的要求,经查阅相关资料后,我的思路如下:以 FPGA 为核心控制单元控制相关模块电路的导通和运行,用霍尔位置传感器采集电动机的转子位置, 经 FPGA 芯片 CycloneⅡ 分析后输出合适信号, 经以 Si9979 为基础的驱动电路放大 后传递至 全桥逆变电路 , 将直流转变为交流进而控制电动机的旋转 、转速和正反转。 器件
13 第四章 频率计的实现 时钟信号分频模块的设计 由于系统时钟为 1Khz,因此要将其进行 1000分频得到 1hz的周期信号,分频程序比较简单,其中 clk为输入的 1Khz系统时钟信号, clk1为输出的 1hz信号,现将源程序摘抄如下: module clkdiv(clk,clk1)。 input clk。 output clk1。 reg clk1。 reg [10:0] count。
上操作数的指令,其中两个分别给出源操作数和目的操作数的地址,第三个操作数用于指出保存本次运算结果的去处。 在有些性能更高的计算机中,还有使用更多操作数的指令,用于完成对一批数据的处理过程,如字符串复制指令和矩阵运算指令等。 上述 4 种情况中的前 3 种,由于其指令字长可以相对较短,执行速度较高,计算机硬件结构可以相对简单等优点,在各种不同的计算机中被广泛应用;相对而言,多操作