Counting Button Pushes


Results 1 to 2 of 2

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Tissy,

    Here's a possibility.   If you do the "De-bouncing" in hardware,

    then you can use the COUNT command
    Code:
    Button2 VAR PORTC.0    ' use a pin with Schmitt Trigger input
    Presses VAR BYTE
    Down CON 0
    
    Main:
        if Button2 = Down THEN
            WHILE Button2 = Down : WEND
    '        Mode = Something
            COUNT  Button2, 3000, Presses
            BRANCHL Presses,[routine0, routine1, routine2, routine3]
            GOTO routine0
        endif
    GOTO Main
    
    '--------------
    routine0:        ' button was not pressed again
                     ' or pressed more than 3 times
    GOTO Main
    
    '--------------
    routine1:        ' pressed once
    
    GOTO Main
    
    '--------------
    routine2:        ' pressed twice
    
    GOTO Main
    
    '--------------
    routine3:        ' pressed thrice
    
    GOTO Main
    Last edited by Darrel Taylor; - 28th November 2005 at 00:01.
    DT

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 09:10
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 03:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 23:43
  4. Button Push within 3 second Window
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2005, 11:06
  5. Button subfunction 16F628
    By Jųan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2005, 17:44

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