Shop OBEX P1 Docs P2 Docs Learn Events
Need some help here! — Parallax Forums

Need some help here!

CreativeCreative Posts: 11
edited 2005-12-09 16:46 in BASIC Stamp
Hi,
·· I'm desperately thinking of ideas to improve my incompleted 'Memory Teaser' game. I have 9 leds and 9 switches. I need to find ways to solve the deboucing problem on the switches. You know, the way keyboard works? When you press a button, the results show on scrn? If possible, links/threads purtaining to solutions for the problem could be pasted here. Thank you!

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-07 03:05
    You might get more responses with a descriptive subject line.· Then people will know what this message is about.· You should consider editing the message and altering your subject line.· Also, wasn't this issue taken care of in this thread?

    http://forums.parallax.com/showthread.php?p=558337


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 12/7/2005 4:32:51 PM GMT
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-12-07 16:12
    Please be more descriptive in your message body as well. What hardware are you running on?

    Have you read in the help file about the BUTTON instruction?

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-07 16:49
    http://www.parallax.com/dl/docs/books/sw/exp/sw15.pdf

    Method used to find: http://search.parallax.com·· keyword: debounce

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • CreativeCreative Posts: 11
    edited 2005-12-08 00:05
    Oh okay, thanks Paul for the link. Any idea on how to enable 9 LEDs in the subprogram as shown in the link which shows example of 4 leds. I'm using Bs2p24 chip.
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-12-08 05:39
    I think you might find this a valuable source of information.
    http://www.parallax.com/html_pages/downloads/sw/sw.asp

    Check out the FREE downloads!
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-08 16:40
    Creative said...
    Oh okay, thanks Paul for the link. Any idea on how to enable 9 LEDs in the subprogram as shown in the link which shows example of 4 leds. I'm using Bs2p24 chip.
    This is a straightforward alteration, but because you caught me in a good mood, Ill give you the replacement lines, ordinarily Id just tell you to read What's a Microcontroller and the Stamp User's manual (which Im still telling you to do, Im just providing you the answer too). This is not a complete code listing, its your job to replace the appropriate lines in the program in the document I cited.

    SwInputs··· VAR· InS

    switches···· VAR· Word

    DEBUG Home, "Inputs = ", IBIN9 switches

    switches··= %0000000111111111


    The switches are connected to P0-P8.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 12/8/2005 4:43:19 PM GMT
  • metron9metron9 Posts: 1,100
    edited 2005-12-08 19:27
    Creative, just remember there is a lot of "tough love" in these forums. I know from my previous posts I have been spanked a few times. One of the things I do now is use the preview post and then read my post. I then say Hmmm what if I.... and then I usually end up not submitting the post because I figure it out myself.

    One thing I can say though, even when I figure something out myself, a reply from one of many talented gurus here that answers the question sometimes answers it in a way that makes it much more clear to me than my own conclusion even though both of the solutions to the problem as essentially the same. These folks sometimes don't realize from our perspective the small seemingly insignificant clues they include in their responses to our questions that greatly improve our understanding of physics.

    I am very lucky to have a brother in-law who just happens to be a very hi tech electronics genius. I Just finished a simple project that worked perfectly fine for what it would do. After showing it to him and asking his opinion he immediately recalculated the number and types of components I was using, narrowed it down to 2 chips that used 1/5 of the power I was using and lowered the cost to produce by 90%. I am an infant when it comes to the brainpower of some of the folks around here and I consider it a privilege to be able to interact with them.

    So keep on posting those questions, heck I can read pretty fast and I would like to see more questions I can answer....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-08 20:08
    Yes the regulars here exhibit tough love (myself included), we want you to learn, which won't happen if we spoonfeed answers to you. Also I am in-depth helping 2 members presently, including nearly every aspect of design and programming, and one also with layout and soldering. As such theres not much time left over to answer questions (though I can't seem to help myself from doing it anyways). I also have a Christmas quilt to sew and 2 of my own projects sitting on my desk, so please understand if you receive curt replies.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • metron9metron9 Posts: 1,100
    edited 2005-12-08 22:01
    Debounceing keys in a nutshell

    First look at the amount of time it should take before you need to process the key again once you receive the signal that it is closed.

    If you have a human pressing just one key and letting go of it quickly you would think about how fast a person could press that key. Now relate that to the number of times your program can scan the key.

    For example, if you only need input once per 3 seconds on any given key, you could simply wait 3 seconds before reading the key. That would enable you to respond to the keypress instantly. You would then set up either a clock using RCtime circuit, or count lines of code in your main loop to estimate the time elapsed before reading the key again. When it comes to microprocessors you need to wrap your mind around the huge time difference in the way you normally think about time. Think of it as looking through a microscope to see the individual atoms that make up the stuff all around us. So a switch contact if looked at under a microscope, you would see sparks flying everywhere, slow time down to your normal view of time and you would see the vibration of both surfaces on the initial contact causing what is called a ringdown vibration or wave. When you bring your thinking into this level you start to see many new ways of gathering data and sending data (electric pulses or Voltage amplitudes) That way you don't just plug in code that works, you understand why it works. Think of yourself being the size of one atom and look at the world from that perspective.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-08 22:11
    Thanks for explaining the theory metron.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • metron9metron9 Posts: 1,100
    edited 2005-12-09 15:36
    After thinking about a bit more, not knowing if this is correct. I would think the flow of electrons starts before the switch contacts even touch. As the contacts get closer together sparks (electrons) jump from one surface to the other surface creating a rapid on off pulse untill the surfaces are actually in contact with each other. Going further, on a microscopic level I don't even know if you can say the two surfaces are actually in contact with each other but I don't know enough about physics.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • Tom WalkerTom Walker Posts: 509
    edited 2005-12-09 16:46
    metron9,
    If you are trying to explain switch contact bounce, I think you are on the wrong track. Bounce is typically a physical phenomenon. Inside the switch there is typically some type of metal strip that makes contact with a metal post. The actual mechanism for this depends on the switch's type (lever, pushbutton, slide, knife, etc...). When the switch is turned "on", by whatever mechanism, there are several "make and break" events as the two electrodes come together. This is typically caused by the electrodes "rubbing" over each other or springiness of the "strip"...again it depends on the mechanism of the switch.

    Sparks, as you describe them, would generally require quite a bit of potential difference to jump the gap (high-voltage). I suppose that there could be an argument for an ever-so-slight "capacitative"-type of effect, but I doubt that it would be sufficient to affect typical switching situations.

    Of course, I could have completely missed the boat as far as your response is concerned...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
Sign In or Register to comment.