Kanupriya

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Kanupriya

  • Rank
    Newbie

Profile Information

  • Gender
    Female
  1. I am coding in Verilog. I am trying to use the MicroJoystick installed on LogicStartMegaWing, the shield with Papilio-One 500k (my FPGA board). I have to do simple tasks like increment or decrement a reg variable on different movements of the joystick. Initially I was running the above code in an alwaya @ (SWITCH) block i.e. the block will be running whenever there is a movement in joystick (on this board joystick shares the pins with five switches). This led to complete loss of control of the cursor on the VGA display (very fast multiple increments or decrements), even on slightest movement of the joystick. Then I ran the same code in an always @ (slowclk) block where 'slowclk' is a 1Hz clock. This led to improvement as there were finite, slower increments or decrements. However, the problem is not completely resolved i.e. on one move of the joystick there are multiple increments to the reg. How can I remove this debounce from the input through the joystick? Need some help on this. I am also putting my code to generate the slowclk and to use the joystick. /////////////// module Slowclock( input clk_25, output reg slowclk ); reg [63:0] i; parameter delay = 12500000; initial begin slowclk = 0; i = 64'd0; end always @ (posedge clk_25) begin if (i < delay) i= i+1; else begin i = 64'd0; slowclk = ~slowclk; end end endmodule ///////////// always @ (slowclk) begin if (SWITCH[0]==0) if (I==0) I <= 3'd5; else I <= I - 1; if (SWITCH1]==0) if (I==5) I <= 3'd0; else I <= I+1; if (SWITCH[3]==0) if (J==5) J <= 3'd0; else J <= J + 1; if (SWITCH[4]==0) if (J==0) J <= 3'd5; else J <= J - 1; end //////////////