Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Signal 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.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    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.

    --- Quote End ---

    Hi,

    It seems to me the problem with your output c. Better to declare before the call . Please check by displaying before stop call and after stop call. In this way, you will get know the problem why it is not stopping.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    HI, kkr, Thanks

    I have already declared c as wire,

    i can't compile it , it said Error (10028): Can't resolve multiple constant drivers for net "motion" at step.v(27)

    My will is to stop sending pulse to the motor,,,,,however i can't...Do u know why
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    HI, kkr, Thanks

    I have already declared c as wire,

    i can't compile it , it said Error (10028): Can't resolve multiple constant drivers for net "motion" at step.v(27)

    My will is to stop sending pulse to the motor,,,,,however i can't...Do u know why

    --- Quote End ---

    you just remove down declaration, and declare only above stop.