Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/24/04 02:21
Read: times


 
#78049 - You got it
Responding to: ???'s previous message
I think I've got it, here's the new code and it appears to be working.


Yes, excellent! Looking at your code it looks like you completely understand the concept of debouncing and came up with a functional implementation. That's great considering the professor had you thinking that a debounce was nothing more than a delay. :)

Just a couple suggestions to optimize things if you're interested.

1. You can get rid of the "MOV A,50H" which comes right after the "DJNZ R6" instruction. It isn't necessary because if A wasn't already the same as the value in 50H then the CJNE inside the DJNZ loop would have aborted the loop and jumped back to RESET1.

2. What you are doing now is checking for the current state of the switch and debouncing it and then checking to see if the switch was actually pressed with your JNZ RESET1 line after the debounce. This will work but usually one checks at the beginning whether or not the key is pressed and only does the debounce if the key is pressed. I probably wouldn't change your code at this point since it works but I just thought I'd let you know how it is usually done.

3. While this is just nitpicking and doesn't make any technical difference, it is usually a good idea to put a blank line between sections of code. I'd probably put a blank line before the RESET line, the READ line, after the JNZ RESET1 line, before the SET and before CLEAR line. That just makes it a little more readable. No big deal... it's a matter of personal style more than anything.

Anyway, great work Lisa.

Regards,
Craig Steiner


List of 55 messages in thread
TopicAuthorDate
Problem with my code            01/01/70 00:00      
   RE: Problem with my code            01/01/70 00:00      
      RE: Problem with my code            01/01/70 00:00      
   RE: Problem with my code            01/01/70 00:00      
      RE: Problem with my code            01/01/70 00:00      
   RE: Problem with my code            01/01/70 00:00      
      RE: Problem with my code            01/01/70 00:00      
         RE: Problem with my code            01/01/70 00:00      
            RE: Problem with my code            01/01/70 00:00      
               RE: Problem with my code            01/01/70 00:00      
               RE: Problem with my code            01/01/70 00:00      
                  RE: Antiques            01/01/70 00:00      
                  RE: Problem with my code            01/01/70 00:00      
                     can't count            01/01/70 00:00      
                        RE: can't count            01/01/70 00:00      
                  RE: Problem with my code            01/01/70 00:00      
                     Validity of state            01/01/70 00:00      
                        RE: Validity of state            01/01/70 00:00      
                           RE: Validity of state            01/01/70 00:00      
                        RE: Validity of state            01/01/70 00:00      
            RE: Problem with my code            01/01/70 00:00      
               Another for the teacher            01/01/70 00:00      
               Fighting academia            01/01/70 00:00      
                  RE: Fighting academia            01/01/70 00:00      
                     RE: Fighting academia            01/01/70 00:00      
                  RE: Fighting academia more            01/01/70 00:00      
                  RE: Fighting academia            01/01/70 00:00      
               RE: Problem with my code            01/01/70 00:00      
                  RE: Problem with my code            01/01/70 00:00      
   RE: Problem with my code            01/01/70 00:00      
      RE: Problem with my code            01/01/70 00:00      
   RE: Replacing school hardware            01/01/70 00:00      
      RE: Replacing school hardware            01/01/70 00:00      
         RE: Replacing school hardware            01/01/70 00:00      
      RE: Replacing school hardware            01/01/70 00:00      
         RE: Replacing school hardware            01/01/70 00:00      
            RE: Replacing school hardware            01/01/70 00:00      
               RE: Replacing school hardware            01/01/70 00:00      
                  RE: Lisas problem            01/01/70 00:00      
                  Debounce, and define current problem            01/01/70 00:00      
                     RE: Debounce, and define current problem            01/01/70 00:00      
                        Defining debouncing            01/01/70 00:00      
                           RE: Defining debouncing            01/01/70 00:00      
                              You got it            01/01/70 00:00      
            RE: good old 6809            01/01/70 00:00      
      RE: Replacing school hardware            01/01/70 00:00      
         RE: Replacing school hardware            01/01/70 00:00      
            STUPID marketing policy            01/01/70 00:00      
               Possibly not entirely stupid...?            01/01/70 00:00      
                  RE: Possibly not entirely stupid...?            01/01/70 00:00      
            RE: Replacing school hardware            01/01/70 00:00      
               RE: Replacing school hardware            01/01/70 00:00      
   C.Steiner, Atari and dev. systems..            01/01/70 00:00      
   RE: Problem with my code            01/01/70 00:00      
      RE: Problem with my code            01/01/70 00:00      

Back to Subject List