具有车辆传感器的交通信号控制器设计Verilog代码Quartus DE2-115开发板

名称:具有车辆传感器的交通信号控制器设计Verilog代码Quartus  DE2-115开发板

软件:Quartus

语言:Verilog

代码功能:

具有车辆传感器的交通信号控制器

设计要求:用 ALTERA公司的 Quartus‖软件和DE2-115开发板进行设计,主要内容

(1)设计一个交通信号灯控制器,利用数码管进行倒计时显示,该控制器控制的交通灯顺序如下

南北方向:绿(15s)、黄(5s)、红(20s)、红(5s)

东西方向:红(15s)、红(5s)、绿(20s)、黄(5s);

(2)南北与东西两路上分别装有车辆传感器k1,k2进行车辆检测,在红灯方向上,若没有车则一直是红灯

要求.jpg

FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com

本代码已在DE2-115开发板验证,DE2-115开发板如下,其他开发板可以修改管脚适配:DE2-115开发板.png

演示视频:

设计文档:

设计文档.doc

1. 工程文件



2. 程序文件



3. 程序编译



4. RTL图



5. Testbench


6. 仿真图





部分代码展示:

/*
红->绿 绿->黄 黄->红
1、红--计时main_red_times------------------------绿--计时main_green_times---main_yellow_times黄灯---------------红
2、绿--计时branch_green_times---branch_yellow_times黄灯--------------------红--计时branch_reg_times-------------------绿
*/
//设东西为主路,南北为支路
module traffic_light(
input clk,//50Mhz
input K1,//支路传感器
input K2,//主路传感器
output main_red,//主路灯
output main_green,//主路灯
output main_yellow,//主路灯
output branch_red,//支路灯
output branch_green,//支路灯
output branch_yellow,//支路灯
output [7:0] HEX0,//(主干道)数码管0
output [7:0] HEX1,//(主干道)数码管1
output [7:0] HEX2,//(支干道)数码管2
output [7:0] HEX3//(支干道)数码管3
);
 wire clk_1Hz;
 wire [7:0] main_green_BCD;
 wire [7:0] main_yellow_BCD;
 wire [7:0] main_red_BCD;
 wire [7:0] branch_green_BCD;
 wire [7:0] branch_yellow_BCD;
 wire [7:0] branch_red_BCD;
 wire [7:0] main_data_out;
 wire [7:0] branch_data_out;
 
wire main_red_led;//主路灯
wire main_green_led;//主路灯
wire main_yellow_led;//主路灯
wire branch_red_led;//支路灯
wire branch_green_led;//支路灯
wire branch_yellow_led;//支路灯
wire main_yellow_flag;
wire branch_yellow_flag;
assign main_red=main_red_led;//主路灯
assign main_green=main_green_led;//主路灯
assign branch_red=branch_red_led;//支路灯
assign branch_green=branch_green_led;//支路灯
assign main_yellow=main_yellow_flag?~clk_1Hz&main_yellow_led:main_yellow_led;
assign branch_yellow=branch_yellow_flag?~clk_1Hz&branch_yellow_led:branch_yellow_led;
//分频模块
div div100
(
. clk(clk),
. clk_out(clk_1Hz)
);

代码文件(付费下载):



1、代码文件需要付费后才可见。
2、支付问题请联系微信公众号客服。
3、优质Verilog/VHDL代码资源,所见即所得。
Verilog/VHDL资源下载 » 具有车辆传感器的交通信号控制器设计Verilog代码Quartus DE2-115开发板

注册为本站会员,充值100得150,详情咨询客服

目前为止共有 *** 位优秀的会员加入! 立刻加入会员