CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account

October 30, 2009 by robert Leave a Comment

Testing new U401/U421 function

New capabilities are being added to the U401/U421 firmware. The first new function that I am testing here is a “Quiz Show” function. Also called “Fastest Finger First”, as it shows which line, of all sixteen of the lines on the device, has been pressed first. This capability is used in game/quiz shows and contests. If a U401/U421 is used without this new firmware, you can poll the device once every eight milliseconds. The trouble is, two buttons may both have been pushed in that time. So then who is the winner? The new device firmware works to fix that.

quizshow

This feature is meant to work when all sixteen lines of the U401/U421 are set to be inputs for buttons. The buttons can be wired to connect the input line to ground with the input line normally pulled high by a resistor. Or the buttons can be wired so that when pressed they bring the port line to 5V, when the ports are normally pulled low by resistors. A 10k resistor per port line (16 total) will work in either case. All sixteen lines need to be treated the same.

If you have fewer than sixteen buttons, the remainder of the port lines still need to be pulled either high or low. For example with 14 buttons, the remaining lines still need to be pulled low or high with resistors, just like the lines that have switches.

Below is a board I use for testing. It can be set up to have the resistors pull the input lines to 5V or to ground, while the red push buttons connect to ground or 5V respectively.

8 button board label2

The remainder of the lines are pulled correctly through resistors and are located on the small test board hidden in the pic below.

ffftest2

Test software was written in RobotBASIC to test the new U401/U421 firmware function. A new command that can be sent to the U401/U421 will return 4 bytes. Two of the bytes (representing 16 lines of course) are valid when there are pull-up resistors, the other two are valid when there are pull-down resistors.

In the example of the pull-down resistors, these two bytes return as all zeros initially, and when no buttons have been pushed. If, on subsequent reads, these bytes are not zeros, then a button has been pressed since the last read. The firmware samples the button input every 128 microseconds (about one eight-thousandth of a second) and latches on the first change. It is still possible to have two buttons appear to be pressed at the same time, but this is likely a wiring problem. Humans pressing buttons just don’t move that quick. (You can sill have software handle this unlikely event with a random choice function.)

This effort was inspired by a user in the United Kingdom that made the test setup below.
Photo0056

Filed Under: Uncategorized Tagged With: button, input, protoboard, RobotBASIC, software, u401, u421

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2023 · Generate Pro Theme on Genesis Framework · WordPress · Log in