Hello there.
There's a common bug with the ON key that i'm pretty sure all DCS users already experienced at least once.
When the key was just released, it's quite often interpreted as pressed right after.
I believe that's basically the result of a bouncing behaviour.
I quite recently performed some deep tests to identify the bouncing duration on TI-8X models (monochrome screen), and it appears it's actually pretty huge.
So, if you're looking for a basic (but safe) debouncing algorithm, here is the one i came up with after my tests :

Code:
;keybdebounce

;DESCRIPTION
;Waits long enough for released keys to stop bouncing.
;Recommended right after a key state just went from pressed to released.

;OUT
;a = ?
;f = %???????0
;bc = $0000
;stack : 2 bytes (call included)

keybdebounce

   ld bc,102
   in a,($02)

   rla
   jr nc,keybdebounce_wait

   in a,($20)

   or a
   jr z,keybdebounce_wait

   ld c,255

keybdebounce_wait

   ld a,(bc)

   djnz keybdebounce_wait

   dec c
   jp nz,keybdebounce_wait

   ret


EDIT : interrupts assumed to be disabled
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3 ... 38, 39, 40
» View previous topic :: View next topic  
Page 40 of 40
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement