Use Button For setup


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Okay I have it working now in ICD mode but not in real life I guess its a timing issue, how would I get into setup as soon as soon as the button is pressed and not having to wait until it is in the loop for setup mode.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Use an interrupt. Or inside of every loop have a GOSUB to check the button.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    To me a Timer interrupt is the most valuable and transparent solution.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Nov 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Unhappy

    Thanks for the help and I have tried mister_e's suggestion about interrupts

    I have tried with the on interrupt with odd results
    the program goes into setup mode with the lcd flickering i guess it is due to the
    goto setsetpoint to refresh the lcd .

    the problem is it will never leave the loop when i press save ( 1 for active 0 inactive)

    I noticed by mistake the if i hold down save the program runs again as soon as i let go it stops, I want the save save to be pressed once and resume running the program.

    I am guessing that I made an error in the code below but it compiles just fine.

    Thanks in advance for any more help.

    SetSetPoint:
    DISABLE

    LCDOut $FE,1, "Setpoint at", #SetPoint, "F"

    if Incr = 1 then 'change the setpoint
    pause 500
    SetPoint=SetPoint+1
    if Setpoint>80 then SetPoint=60 'Allow setpoint from 60 to 80

    goto SetSetPoint 'refresh LCD with new setpoiont
    endif

    If Save = 0 then goto SetSetPoint

    Resume
    ENABLE

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Try adding
    Code:
    IF Save = 1 then GOTO loop
    before
    Code:
    If Save = 0 then goto SetSetPoint
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Nov 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Unhappy

    Thanks tried your suggestion but still not working.

    When save = 1
    I want it to exit the loop and resume running the program, am I missing something obvious, or not so obvious since I am new at this ???

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Maybe it is a debounce problem. Add a "PAUSE" at the beginning of "loop".
    Code:
    loop:
    PAUSE 250 'Give a little time to get off the button
    if Setup = 1 then
    Dave
    Always wear safety glasses while programming.

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