SOLVED: Post #11 - IOC on negative edge sometimes triggers twice on single press


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: IOC on negative edge sometimes triggers twice on single press

    Quote Originally Posted by HenrikOlsson View Post
    ...But simply setting a flag that there's been an interrupt and then poll that flag in the main loop is...well of not much use and a waste resources. Just poll the interrupt flag (and remember to reset it) instead....
    It's not a rant if you guys help me. I didn't know that about the IOC flag being set regardless (I've done a lot of reading on Interrupt - remembering what I read is something else entirely).

    Richard did find the real problem. I was using 0.01uF for the encoder and the switch. This is what it looked like at higher resolution:




    Then I changed for 0.1uF:



    Just a blip on this one:




    But I have to use 0.01uF on the encoder or else they don't act properly.


    So now I have to decide if I keep the 16F18877 and poll the IOC flag, or go back to the 16F1937 and poll the Port pin. I'm leaning towards the 16F1937 cause it costs a bit less.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: SOLVED: Post #11 - IOC on negative edge sometimes triggers twice on single press

    Turns out I don't really have a choice to stay with the 16F18877:

    - 16F1937 has TTL General Purpose pins.
    - 16F18877 has TTL and ST General Purpose pins.

    74HC14 only costs $0.09 at JLCPCB, but there's other costs associated with assembly, as well as lost real-estate on the PCB:
    https://jlcpcb.com/parts/componentSe...archTxt=C97666
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Aug 2011
    Posts
    457


    Did you find this post helpful? Yes | No

    Default Re: SOLVED: Post #11 - IOC on negative edge sometimes triggers twice on single press

    Quote Originally Posted by Demon View Post
    - 16F1937 has TTL General Purpose pins.
    - 16F18877 has TTL and ST General Purpose pins.
    You should be able to set the pin type in the 16F18877 to either ST or TTL to match the 1937 type if that's what you're after.
    I don't think your 'INLVLB = %00000100' statement changed anything for RB2... it's still the default setting.

Similar Threads

  1. Replies: 8
    Last Post: - 30th August 2024, 19:45
  2. calling subroutine triggers interrupt
    By Alexey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th May 2011, 03:50
  3. Replies: 5
    Last Post: - 26th February 2011, 05:51
  4. Button press and press & hold how to ?
    By GrandPa in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 22nd August 2007, 03:37
  5. Best way to find a rising edge?
    By jcsquire in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st May 2006, 15:11

Members who have read this thread : 1

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