- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can someone help me how to design coding that catch number 8 and it will increment the counter..i've done the coding but cannot catch number 8..it will catch random number....
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- can someone help me how to design coding that catch number 8 and it will increment the counter..i've done the coding but cannot catch number 8..it will catch random number.... --- Quote End --- Why don't you post what you've tried so far. In VHDL the code would look something like;
constant WIDTH : integer := 4;
signal match : std_logic;
signal match_value : std_logic_vector(WIDTH-1 downto 0) := X"8";
...
match <= '1' when (count = match_value) else '0';
Cheers, Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if Reset='0' then
level<="0000";else if PUSH'event and PUSH='1' then if X=8 then if (level < 10) then level <= level +1; else level <= "0000"; end if; end if; --can i do like this?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- --can i do like this? --- Quote End --- No, probably not. You need to use a proper clock and separate the logic into functional blocks; 1) Push button interface, with debounce logic * synchronize the push-button to the clock * detect an edge, and then ignore the input for a while 2) A counter 3) Synchronized push-button and match control logic Create a testbench for your logic, eg., something that contains a clock and a noisy push-button press, and use that to confirm that you only see one button press. If you don't know how 'noisy' to make your button press, create a simple design and download it into your hardware. Add a SignalTap II instance and capture a trace from a push-button press. You will see that the signal generates multiple transitions when you click on the button. Your debounce logic needs to convert the ugly push-button signal into a nice clean logic level. Cheers, Dave

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page