ISE实现多功能数字钟设计

assign

ENM_H=(Adj_Min&&(TMinute[3:0]==4'h9))||(TMinute[3:0]==4'h9)&&(TSecond==8'h59);//24小时制

counter24 H0(Hour_24[7:4],Hour_24[3:0],nCR,ENH,EN,CP_1Hz);

assign

ENH

=

Adj_Hour?Vdd:((TMinute==8'h59)&&(TSecond==8'h59));

//===========12小时与24小时进制切换控制==========

assign

Display_HourAdjust=((Hour_24==8'h20)||(Hour_24==8'h21))?(Hour_24-24):(Hour_24-18);

assign Hour_12 = (Hour_24<8'h13)?Hour_24:Display_HourAdjust; assign Display_HourT = Hchange?Hour_12:Hour_24; //===========闹钟============ //----------时钟秒---------

//counter60 CCS(nCR,CP_1Hz,EN,CSecond[7:4],CSecond[3:0]); //----------时钟分---------

counter60 CCM(nCR,CP_1Hz,CMin_EN,CMinute[7:4],CMinute[3:0]); //--产生分使能信号--

assign CMin_EN = (!EN && Adj_Clock && Adj_Min); //----------时钟时---------

Counter24C CCH(nCR,CP_1Hz,CHour_EN,CHour[7:4],CHour[3:0]); //--产生时使能信号--

assign CHour_EN = (!EN && Adj_Clock && Adj_Hour); //--闹钟响--

always@(EN or Clock_EN) //闹钟开关 begin

if(EN && Clock_EN && (CHour == Display_HourT) && (CMinute ==

TMinute))Alarm <= 1;

else Alarm <= 0;

end

always@(posedge CLK_50 or negedge EN or negedge Alarm) //表示闹钟

的LED

begin

if(~EN) Led_Alarm <= 0; else begin

if(~Alarm) Led_Alarm <= 0; else Led_Alarm <= ~Led_Alarm;

end

end

//alarm_clock

AL0(Hour24,Minute,CP_1Hz,Set_Alarm,Close_clock,nCR,KeySet_Hour_ev,KeySet_Minute_ev,LD_7,Alarm_Hour,Alarm_Minute);

//===========数码显示=========

always@(Adj_Clock)//确定数码管显示闹钟还是正常时钟

begin

if(Adj_Clock) begin Display_Hour <= CHour;Minute <= CMinute;end else begin Display_Hour <= Display_HourT;Minute <= TMinute;end

end

always@(posedge CP_200Hz) begin

if(Change==1)

begin

case(HEX)

4'b1110: begin HEX<=4'b0111; bcd<= Display_Hour

//数码管进行时分显示

[7:4]; end //第一根数码管显示小时十位

4'b0111: begin HEX<=4'b1011; bcd<= Display_Hour

[3:0]; end //第二根显示小时个位

4'b1011: begin HEX<=4'b1101; bcd<= Minute [7:4];

end

//第三根显示分钟十位

4'b1101: begin HEX<=4'b1110; bcd<= Minute [3:0];

end

//第四根显示分钟个位

default: begin HEX<=0111; bcd<=Display_Hour [7:4]; end endcase

end

//数码管进行秒显示,change为低电

else

平时显示秒

begin

case(HEX)

4'b1110: begin HEX<=4'b1101; bcd<= TSecond [7:4];

end

//第三根显示秒十位

4'b1101: begin HEX<=4'b1110; bcd<= TSecond [3:0];

end

//第四根显示秒个位

default: begin HEX<=1101; bcd<= TSecond [7:4]; end endcase

end

end

SEG7_LUT L0(HEX0,bcd);

//调用数码管子函数

//======整点报时========== assign LD_6 = LD_6_RADIO;

always@(CP_1Hz) begin

==

8'h00)

&&

(counter[7:0]

<

if((Minute[7:0] (Hour_24[7:4]*10 + Hour_24[3:0])))

begin

LD_6_RADIO <= CP_1Hz;

end

else

联系客服:779662525#qq.com(#替换为@)