always @ (posedge Clkin,negedge Resetb)
if(!Resetb)
begin
DataIN<=16'd0;
//StartM<=0;
//CodeOUT<=16'd0;
//ROUT<=0;
//POUT<=0;
//YOUT<=3'd0;
LED1<=0;
LED2<=0;
LED3<=0;
LED4<=0;
LED5<=0;
LED6<=0;
SETCode<=16'd0;
MRun<=0;
Cnt1<=2'b0;
end
else
begin
SETCode<=16'd30000;
case(Cnt1)
2'b00:
begin
if(!StartM)
begin
Cnt1<=2'b01;
end
else
begin
Cnt1<=2'b0;
end
end
2'b01:
begin
MRun<=1;
if(YOUT==3'b001)
begin
Cnt1<=2'b10;
end
else
begin
Cnt1<=2'b01;
end
end
2'b10:
begin
MRun<=0;
Cnt1<=2'b0;
end
endcase
end
又用万用表测试了一下复位信号,在按下复位开关时,电平由3.29V变为0。01V,复位信号应该是有了,可是板子还是没反应,CPLD好任性啊
2.检测管脚约束与板卡上的时钟和复位是否对应。
3.看一下LED灯是高电平亮还是低电平亮,对比代码中的赋值。
这个是管脚配置,我都按原理图做了配置,另一个程序复位置灯管脚低的也是按图做的配置
量一下时钟有没有。
或者你试试 always里面用异步复位不要用同步。
用同步的话如果你时钟没有输入那灯就不会亮。
always @ (posedge Clkin,negedge Resetb)
if(!Resetb)
begin
DataIN<=16'd0;
//StartM<=0;
//CodeOUT<=16'd0;
//ROUT<=0;
//POUT<=0;
//YOUT<=3'd0;
LED1<=0;
LED2<=0;
LED3<=0;
LED4<=0;
LED5<=0;
LED6<=0;
SETCode<=16'd0;
MRun<=0;
Cnt1<=2'b0;
end
else
begin
SETCode<=16'd30000;
case(Cnt1)
2'b00:
begin
if(!StartM)
begin
Cnt1<=2'b01;
end
else
begin
Cnt1<=2'b0;
end
end
2'b01:
begin
MRun<=1;
if(YOUT==3'b001)
begin
Cnt1<=2'b10;
end
else
begin
Cnt1<=2'b01;
end
end
2'b10:
begin
MRun<=0;
Cnt1<=2'b0;
end
endcase
end
又用万用表测试了一下复位信号,在按下复位开关时,电平由3.29V变为0。01V,复位信号应该是有了,可是板子还是没反应,CPLD好任性啊
一周热门 更多>