我用maxII 的EPM240T100C5,程序如下:
module demo(SysClk,oev,cph1);
//---------------------------------------
input SysClk;
output oev;
output cph1;
reg oev;
reg cph1;
reg [2:0] counter;
reg [7:0] countX;
always @(negedge SysClk) begin
if(counter<5)
counter<=counter+1;
else
counter<=0;
if(counter==0)
cph1<=1;
else if(counter==3)
cph1<=0;
end
always @(negedge cph1) begin
if(countX<200)
countX<=countX+1;
else
countX<=0;
if(countX==0)
oev<=1;
else if(countX==50)
oev<=0;
end
endmodule
下载,用示波器观察,cph1波形正确,oev每隔2秒会周期性输出低电平(500毫秒),然后输出又正确,
百思不得解.
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |