button problems


Closed Thread
Results 1 to 4 of 4

Thread: button problems

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    I dont understand what all this stuff with yy is for.

    Why not use something like this:

    Code:
    if portb.7=1 then                      ' If button is pressed:
        toggle portb.1                     ' Toggle the LED
        loop: if portb.7=1 then goto loop  ' Wait until the button is released
    endif

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    anyway, the reason for your subroutine not working is becuase this statement will never be true: "if yy=2 and portb.7=0 then", becuase you only jump to the subroutine when portb.7=1.

    Instead of this:

    if portb.7=1 then
    gosub flipflop
    endif

    Try just this: "gosub flipflop"

    Also, there is no return from the subroutine... instead of "goto start", put "return"
    Last edited by Kamikaze47; - 22nd November 2005 at 10:10.

Similar Threads

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