Altera_Forum
Honored Contributor
12 years agoSignal related problem ----Stop the output (Urgent)
module simplemotion(motion,key_0, CLK_50M,VCC);
output motion; input key_0; input CLK_50M; input VCC; slowclock(CLK_50M, pulse); wire pulse; reg motion; always @(posedge pulse) if (key_0==1) motion = pulse; stop(CLK_50M,c); wire c; always @(posedge c) if (c==1) motion =0; // in this step i am trying to stop the motion , however, i couldn't because motion cannot be multiple constant. endmodule module stop(CLK_50M,c); input CLK_50M; output c; reg [20:0] count; always @(CLK_50M) count = count+1; assign c = count[20]; endmodule module slowclock(CLK_50M, pulse); input CLK_50M; output pulse; reg [15:0] counter; always @(posedge CLK_50M) counter<=counter+1; assign pulse = counter[15]; endmodule My code is wrong, i have been working on this for weeks, still can't stop sending out the pulse to the motor at some specific time. Can anyone help? Thank you.