Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1975999
  • 博文数量: 356
  • 博客积分: 8284
  • 博客等级: 中将
  • 技术积分: 4580
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-15 20:25
个人简介

天行健,君子以自强不息

文章分类

全部博文(356)

文章存档

2018年(1)

2016年(4)

2015年(13)

2014年(14)

2013年(2)

2012年(25)

2011年(43)

2010年(65)

2009年(189)

分类:

2009-09-21 20:08:52

//0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90
module shu_ma_guan(seg,clk,seg1,seg2,seg3,seg4,seg5,seg6,seg7);
 input clk;
 output [7:0] seg;
 ////////////////////////////
 output [7:0] seg1,seg2,seg3,seg4,seg5,seg6,seg7;
 reg [7:0] seg1,seg2,seg3,seg4,seg5,seg6,seg7;
 //////////////////////
 reg [7:0] seg;
 reg [3:0] dispdat;
 reg [27:0] count;
always @(posedge clk)
 begin
 count=count+1;
 end
always
 begin
 dispdat=count[27:24];
 if(dispdat>9)  dispdat=4'b0000;
 end
always @(dispdat)
 begin
 
  case(dispdat)
   4'h0:seg=8'hc0;
   4'h1:seg=8'hf9;
   4'h2:seg=8'ha4;
   4'h3:seg=8'hb0;
   4'h4:seg=8'h99;
   4'h5:seg=8'h92;
   4'h6:seg=8'h82;
   4'h7:seg=8'hf8;
   4'h8:seg=8'h80;
   4'h9:seg=8'h90;
  endcase
 
 end
//////////////////////关闭不用的数码管//////////////////////////////////
always
 begin
 seg1=8'hff;
 seg2=8'hff;
 seg3=8'hff;
 seg4=8'hff;
 seg5=8'hff;
 seg6=8'hff;
 seg7=8'hff;
 end
//////////////////////////////////////////////////////////// 
 
 
endmodule
文件: shu_ma_guan.rar
大小: 276KB
下载: 下载

 
阅读(605) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~