​ ​ ​ ​ Help with push-button to change LED flash pattern - Page 2
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14

Thread: Help with push-button to change LED flash pattern

  1. #11
    Senior Member
    Join Date
    Nov 2009
    Location
    UK
    Posts
    999

    Default

    the first thing that stands out to me is you call the interrupt and then a goto command, you never return to the interrupt and never return from the interrupt which I would think will cause a stack overflow once you have called however many returns can be stacked into the 08M2. I quick glance through the code and Marks version should resolve that, however do note that it will finish running which ever flash sequence its on.

  2. #12
    New Member
    Join Date
    Aug 2015
    Location
    Edmonton Alberta
    Posts
    5

    Default This gets pretty close to what I had in mind.

    [QUOTE=marks;305362]Hi dbeatty,
    merry Christmas and welcome to the forum.
    I didn't look at the video just modded your code abit
    I think its what your trying to do hopefully should be enough to get you rolling !


    The button responds immediately.

    A longer flash sequence will cycle one time before the next one activates.
    I must give this some attention.

    Otherwise it works a treat.

    Thank you for your time.

    David

  3. #13
    New Member
    Join Date
    Jun 2015
    Location
    Australia
    Posts
    21

    Default

    Hi dbeatty,

    Looks like Marks nailed it for you.

    Only thing I didn't see in there was any form of software debounce for your button.

    Perhaps...

    Code:
    Interrupt:                             'used to get an immediate button response
              do while pinc.4=1 loop
             pause 600                     'Software debounce for potential button noise.
             inc b1                        'cause the program to select the next flash sequence   
             setint %00010000,%00010000    'resets the setint for the next button push   
            if b1 > 8 then : b1=0 :endif    
          return
    As you are using setint, without software debouncing it may be susceptible to multiple triggers in the blink of an eye.



    Regards,
    Morty.

  4. #14
    New Member
    Join Date
    Aug 2015
    Location
    Edmonton Alberta
    Posts
    5

    Default

    Thanks Morty,

    You make a good point. I have some time this morning to work with the program. I'll include the debounce.

    Happy New Year

    David @ Edmonton, AB

Bookmarks

Posting Permissions

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