PORTB + PORTC Interrupt-On-Change


Results 1 to 28 of 28

Threaded View

  1. #13
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: PORTB + PORTC Interrupt-On-Change

    I'm a little confused by your requirements.

    You state it is a mechanical system - suggesting some debounce might be necessary(?), or is this part of the fault condition to be counted? You worry for the speed of the system and capturing every event, but then state the count need not be too accurate... The requirements are likely very clear in your mind, but reading... it leaves me wondering, just how fast an event you wish to capture and what constitutes an event?

    Here we go into areas I'm not qualified to speak with much expertise...

    I had imagined some level of filtering to eliminate the tiniest of glitches - capacitors, as used on power supply, to eliminate noise and other such tiny perturbances and measuring events in the range of a few milliseconds - maybe less, I hadn't really thought of minimal times possible, only to make a stable system that reacts reliably and consistently rather than to every stray passing gamma ray . Henrik's suggestion to use ORs is much better... I thought to use latching flip-flops to maintain state until the PIC could read and reset in a tight loop/ interrupt. My idea being that mechanical systems are typically pretty slow and messy, and accuracy at the level I work is typically limited to what I can see and measure. This seems not to be the case for your requirements.

    Well, in any case it has been an interesting read - and you have determined an answer suitable... back to the bench for me!

    Oh, as to your question... I'd likely stack all the flags into a bit array and then loop through as:

    For LOOP = 0 to 8 'For each flag
    If BIT[LOOP] Then 'If bit is set
    CounterWord[LOOP] = CounterWord[LOOP] + 1 'Add one to count
    EndIf
    Next


    ...unless, as I was typing, Henrik posted a more artful method in the post following.
    Last edited by Amoque; - 18th March 2014 at 12:46.

Similar Threads

  1. PortB Change Interrupts
    By backstabber in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 8th October 2011, 03:52
  2. Replies: 10
    Last Post: - 24th September 2011, 18:09
  3. Replies: 6
    Last Post: - 12th March 2011, 13:11
  4. Returning from Int on PortB change
    By sheryl in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th December 2008, 18:09
  5. Interrupt portb
    By tazntex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 18th August 2008, 21:05

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