|
- module cd4060( //14级纹波进位下降沿触发二进制计数器 VCC:Pin16 GND:Pin8
- input RS, //时钟输入或外接晶振(下降沿计数) Pin11
- output RTC, //外接RC振荡定时电阻 Pin10
- output CTC, //外接RC振荡定时电容 Pin9
- input MR, //低电平允许计数 异步高电平计数清零复位且停止振荡 Pin12
- output Q13, //16384分频(输入32768Hz,输出2Hz) Pin3
- output Q12, //8192分频 Pin2
- output Q11, //4096分频 Pin1
- //没有Q10,Q2,Q1,Q0
- output Q9, //1024分频 Pin15
- output Q8, //512分频 Pin13
- output Q7, //256分频 Pin14
- output Q6, //128分频 Pin6
- output Q5, //64分频 Pin4
- output Q4, //32分频 Pin5
- output Q3 //16分频 Pin7
- );
- reg [13:0] Q = 14'd0;
- assign {Q13,Q12,Q11,Q9,Q8,Q7,Q6,Q5,Q4,Q3} = {Q[13:11],Q[9:3]};
- assign {RTC,CTC} = MR ? 2'bzz : {~RS,RS};
- always @(negedge RS or posedge MR) begin
- if(MR) begin
- Q <= 14'd0;
- end else begin
- Q <= Q + 14'd1;
- end
- end
- endmodule
- module main(
- input clk,
- output out
- );
- cd4060 U1(
- .RS(clk),
- .MR(1'b0),
- .Q13(out)
- );
- endmodule
复制代码 |
|