Make PIC simulate binary up/down counter - how to calculate how fast can it count?


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Make PIC simulate binary up/down counter - how to calculate how fast can it count

    Thank you Richard,
    Could you take a moment to describe what happens with edge detection on both channels?

    Sincere thanks!
    dw

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Make PIC simulate binary up/down counter - how to calculate how fast can it count

    every edge [transition] is a decodable step for the encoder
    Name:  quadrature.jpg
Views: 1280
Size:  13.2 KB

    you catch each step with an edge triggered pin interrupt, you need a better chip , 16f1825 or something useful
    Warning I'm not a teacher

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Make PIC simulate binary up/down counter - how to calculate how fast can it count

    We had a similar discussion not that long ago, might be worth revisiting.
    It's important to remember that one usually want to do more than JUST keep track of an enocder and that has to be accounted for. Anyway, here's a link to that thread: http://www.picbasic.co.uk/forum/show...ght=quadrature

  4. #4
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Make PIC simulate binary up/down counter - how to calculate how fast can it count

    Quote Originally Posted by HenrikOlsson View Post
    We had a similar discussion not that long ago, might be worth revisiting.
    It's important to remember that one usually want to do more than JUST keep track of an enocder and that has to be accounted for. Anyway, here's a link to that thread: http://www.picbasic.co.uk/forum/show...ght=quadrature
    Thank you Hendrik.
    That gave me a lot to think about.
    One of the examples in that thread has the pic checking for 4 possible conditions of two bits, and remembering the last condition of those two bits.
    With my experiments so far - I haven't found that to be necessary in order to maintain accuracy.

    I have a pic that simulates the output of an encoder, starting with pulse periods of 15ms.
    It produces 180 cycles in the CW direction - then pauses - and then produces 180 cycles in the CCW direction.

    After each CW/CCW process - it starts over - but with a little shorter pulse period.
    I then monitor my programs decoder output on an LCD display.
    If all goes well - it starts at 0 - goes to 180 counts and then returns to 0.

    I know when the processor is starting to loose track when the LCD displays bad numbers.
    So far I've been able to accurately track pulse periods down to 5milli-seconds.
    That may in fact be satisfactory for my usage - but I'm still playing with other options.

  5. #5
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Make PIC simulate binary up/down counter - how to calculate how fast can it count

    Richard - thank you for pointing me to that PIC!!!
    I was going to ask about newer PICs with internal OSC running at higher speeds
    But I hadn't even imagined one running at 32Mhz

    Very sweet!!
    And thank you for the emphasizing catching each edge with an ONCHANGE interrupt.
    I'll be doing some further research on that - especially with a faster device!

    Sincere thanks :-]

Similar Threads

  1. Replies: 7
    Last Post: - 19th December 2016, 17:19
  2. Use a PIC ADC like a fast interrupt comparator?
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th August 2011, 05:33
  3. Fast yet reliable PIC-PIC communication?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th September 2009, 15:34
  4. How to calculate PIC sampling frequency
    By minmin in forum General
    Replies: 1
    Last Post: - 26th September 2006, 18:02
  5. Simulate a mouse with a PIC
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st September 2006, 00:13

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