{"id":31394,"date":"2025-04-28T07:29:02","date_gmt":"2025-04-28T14:29:02","guid":{"rendered":"https:\/\/digilent.com\/blog\/?p=31394"},"modified":"2025-04-28T07:29:02","modified_gmt":"2025-04-28T14:29:02","slug":"learn-state-machines-counters-with-the-basys-3-stopwatch-challenge","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/learn-state-machines-counters-with-the-basys-3-stopwatch-challenge\/","title":{"rendered":"Learn State Machines &#038; Counters with the Basys 3 Stopwatch Challenge"},"content":{"rendered":"<p><span data-contrast=\"auto\">Ready to put your digital logic knowledge to the test? We&#8217;re excited to share a project that brings fundamental concepts like state machines and counters to life using the popular <a href=\"https:\/\/digilent.com\/shop\/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users\/?srsltid=AfmBOooSC0qvLZQZ-1l2kPZhmNx_oecnEsaE2DOdx-aM3MMIfyY3pP8C\">Basys 3 FPGA development board<\/a>.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">This isn&#8217;t just about theoretical learning \u2013 it&#8217;s about hands-on interaction. Imagine this: you press a button to start a timer displayed on the Basys 3&#8217;s 7-segment display. Then, with precise timing, you try to stop it at the exact moment a visual cue \u2013 the Basys 3&#8217;s LEDs filling up \u2013 indicates the target.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">This project is a good example of the kind of practical exercises students in digital logic courses can undertake. By working through this &#8220;Stopwatch Challenge,&#8221; learners can gain a deeper understanding of:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">State Machines:<\/span><\/b><span data-contrast=\"auto\"> See how different states control the flow of the game.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Counters:<\/span><\/b><span data-contrast=\"auto\"> Observe how digital counters track time.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Hardware Description Languages (HDLs):<\/span><\/b><span data-contrast=\"auto\"> Understand how Verilog is used to implement these core hardware building blocks.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<h4><strong>Let\u2019s break it down into steps:\u00a0<\/strong><\/h4>\n<ol>\n<li><span data-contrast=\"auto\">Design a counter and use it to blink an LED ten times a second.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Design a basic state machine to enable and disable the blinking LED based on button presses.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">For bonus points, debounce your buttons.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Modify your counter to count up or down, selected based on an input. Decode this counter and use it to\u00a0drive the Basys\u2019 LEDs.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Design a binary-coded decimal counter.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Design a seven-segment display controller and use it to display decimal numbers.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Modify your state machine to pull together these disparate parts into a game \u2013 enable the decimal counter when the game is started, pick success and fail states based on the state of the up\/down counter when buttons are pressed, and clear counters (or not!) based on success\/fail status.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/Basys3-Rev-1024x702.webp\" alt=\"\" width=\"735\" height=\"504\" class=\"alignnone size-large wp-image-31396\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/Basys3-Rev-1024x702.webp 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/Basys3-Rev-600x411.webp 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/Basys3-Rev-135x93.webp 135w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/Basys3-Rev.webp 1280w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<h4><b><span data-contrast=\"auto\">Here&#8217;s what you&#8217;ll need:<\/span><\/b><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/h4>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">A Basys 3 FPGA development board.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">A MicroUSB programming cable.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">The free Vivado design suite (compatible with the 2024.1 release).<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ul>\n<h4><b><span data-contrast=\"auto\">Ready to try the Stopwatch Challenge?<\/span><\/b><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/h4>\n<p><a href=\"https:\/\/digilent.com\/reference\/programmable-logic\/basys-3\/demos\/stopwatch#functionality\"><span data-contrast=\"none\">https:\/\/digilent.com\/reference\/programmable-logic\/basys-3\/demos\/stopwatch#functionality<\/span><\/a><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Whether you&#8217;re a student looking for a practical learning exercise or an educator seeking engaging lab ideas, this Basys 3 Stopwatch Challenge offers a compelling way to explore the fundamentals of digital logic design. Give it a try and see how precisely you can stop the timer!<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-31394 jlk' data-task='like' data-post_id='31394' data-nonce='1c819b3974' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-31394 lc'>+1<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-31394 jlk' data-task='unlike' data-post_id='31394' data-nonce='1c819b3974' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-31394 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-31394 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Ready to put your digital logic knowledge to the test? We&#8217;re excited to share a project that brings fundamental concepts like state machines and counters to life using the popular &hellip; <\/p>\n","protected":false},"author":64,"featured_media":31395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4327,1563,1561,4326],"tags":[4852,5131,5135,4855,1662,5133,5023,4397,5110,5134,104,5132,5130,453],"ppma_author":[4587,4458],"class_list":["post-31394","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","category-guide","category-applications","category-teaching-training","tag-basys-3","tag-challenge","tag-counter","tag-digital-logic","tag-fpga","tag-fpga-development-board","tag-hdl","tag-hdls","tag-led","tag-microusb","tag-project-2","tag-state-machine","tag-stopwatch","tag-vivado"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2025\/04\/2025-Apr-Newsletter-Basy3Stopwatch-735x400-1.png","authors":[{"term_id":4587,"user_id":0,"is_guest":1,"slug":"digilent","display_name":"Digilent","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""},{"term_id":4458,"user_id":64,"is_guest":0,"slug":"kdokes","display_name":"Kyli Dokes","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/cdb921328f1f23c751c9aa761dd1673ff76a87dbdf54738433573ad284fc2f12?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/31394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=31394"}],"version-history":[{"count":4,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/31394\/revisions"}],"predecessor-version":[{"id":31400,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/31394\/revisions\/31400"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/31395"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=31394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=31394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=31394"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=31394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}