【XC6SLX9 TQC144】50MHz系统时钟分频实现LED跑马灯

来源:互联网 发布:淘宝怎么打印电子发票 编辑:程序博客网 时间:2024/06/10 20:12

1.硬件

S6 Card开发板:XC6SLX9 TQC144芯片

2.功能

板子上8个LED按照二进制加法方式亮灭。

3.代码

`timescale 1ns / 1ps//////////////////////////////////////////////////////////////////////////////////// Company: // Engineer: // // Create Date:    10:17:44 07/20/2017 // Design Name: // Module Name:    test // Project Name: // Target Devices: // Tool versions: // Description: //// Dependencies: //// Revision: // Revision 0.01 - File Created// Additional Comments: ////////////////////////////////////////////////////////////////////////////////////module test( input clk,//56引脚    output [7:0] out//80-88引脚    );reg [7:0] out;reg [31:0]count;initial beginout = 8'h0;count = 0;endalways@(posedge clk)beginif(count == 50000000)//50MHz分频为1Hzbegincount = 0;out = out + 1;endelsecount = count + 1;if(out > 8'hff)out = 0;endendmodule

4.引脚约束

最上面的LED(D8)连接P80,从上至下依次为P80-P88。


原创粉丝点击