软件:Quartus
语言:Verilog
代码功能:
温度控制器设计
要求:
1.当温度高于标值时,电动机正转,降温;
2.当温度低于标值时,电动机反转,升温;
3.要能够实时监测温度,并通过数码管显示;
4.温度使用按键控制升高或者降低。
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
3. 程序编译
4. RTL图
5. 管脚分配
6. Testbench
7. 仿真图
整体仿真图
按键上升沿检测模块
温度控制模块
显示模块
电机控制模块
部分代码展示:
module temperature( input clk,//时钟 input rst,//复位,高电平 input key_add,//输入加按键 input key_sub,//输入减按键 //电机 output IN_a, output IN_b, output IN_pwm, //共阳极数码管 output [7:0] segment,//数码管段选显示 output [3:0] select//数码管位选显示 ); wire [7:0] tempe;//温度 wire add;//增加键 wire sub;//减小键 //按键上升沿检测模块 key_posedge i0_key_posedge( . clk(clk),//时钟 . key_in(key_add),//输入按键 . key_posedge(add) //按键上升沿 ); key_posedge i1_key_posedge( . clk(clk),//时钟 . key_in(key_sub),//输入按键 . key_posedge(sub) //按键上升沿 ); //温度增加或者减小模块 add_sub i_add_sub( . clk(clk),//时钟 . add(add),//增加键 . sub(sub),//减小键 . tempe(tempe)//温度 ); //电机控制 motor_ctrl i_motor_ctrl( . clk_1KHz(clk),//时钟 . rst(rst),//复位,高电平 . tempe(tempe),//温度 //电机 . IN_a(IN_a), . IN_b(IN_b), . IN_pwm(IN_pwm) );
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=1305
阅读全文
401