ADC keyboard and fast response to user input, possible?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: ADC keyboard and fast response to user input, possible?

    So what I need.
    if user presses key, there should be immediate response, but if he keeps it pressed, variable value should increase slowly, so he won't skip desired value.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default Re: ADC keyboard and fast response to user input, possible?

    I would try something like this. Of course, you have to

    define var key
    K_None con 0
    K_Inc con 1
    K_Dec con 2

    Code:
    AdcSub:
            ADCIN 0,x
            if x = $FF then key = K_None
            if x < 125 then key= K_Dec
            if x > 130 then key = K_Inc
    return
    
    
    MAINCODE:
    
          Gosub AdcSub
          if key = K_Inc then 
                y=y+1
                goto Mydelay
          endif
          if key = K_Dec then 
                y = y-1
    Mydelay:
                pause 100
          endif
          Gosub Display
    goto Maincode

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: ADC keyboard and fast response to user input, possible?

    Quote Originally Posted by CuriousOne View Post
    So what I need.
    if user presses key, there should be immediate response, but if he keeps it pressed, variable value should increase slowly, so he won't skip desired value.
    Hi,

    What's YOUR time lag for " immediate " ...

    as always, this is a highly subjective point of view ...

    Generally ... " immediate " means ... Interrupt !

    Knowing your general way of thinking ... that probably could be much slower than a few microseconds ...

    just consider the time spent between your thinking you must strike a key, and the act of striking the key, may be add the time needed to analyze the info that decide you to strike wich key , plus the time to define as a target the right key ... : interesting point of view, no ???

    " immediate ", you told ???

    Alain
    Last edited by Acetronics2; - 29th June 2020 at 19:04.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: ADC keyboard and fast response to user input, possible?

    LOL.

    Do you have at least TV remote at hands?

    when you press say channel up button, it immediately switches the channel (the actual change might occur a bit later, but here we're talking about system response), but if you keep it pressed, it will slowly cycle between channels.

    So I think I should do the code in the following way:

    Once key is pressed, start counter, say to 100, and do pause 1 inside it. If user releases key before counter hits 100, then do the action. But if user keeps key pressed and counter reached say 200, do the action, reset counter and start again.

Similar Threads

  1. another way to get a keyboard matrix to work off 1 adc pin
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 4th May 2013, 01:23
  2. Use a PIC ADC like a fast interrupt comparator?
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th August 2011, 05:33
  3. Storing user input - whassall that about then?
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th July 2010, 15:08
  4. Replies: 17
    Last Post: - 13th June 2008, 21:33
  5. Reading multiple ADC channels FAST
    By lwindridge in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st April 2004, 22:37

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts