Shop OBEX P1 Docs P2 Docs Learn Events
Reading an encoder using counters or TV hardware? — Parallax Forums

Reading an encoder using counters or TV hardware?

Graham StablerGraham Stabler Posts: 2,510
edited 2009-08-05 15:08 in Propeller 1
I am sure I remember someone came up with a super clever way of reading quadrature encoders at lightning speed using either counters or the TV hardware but I can't remember any other details, am I imagining this?

Cheers,

Graham

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-04 18:22
    Graham,

    How fast are are the pulses that you need to decode and count?

    -Phil
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-08-04 22:41
    I need to monitor six encoder with peak frequencies of around 400khz.

    I wrote code in assembly for tracking a single encoder which is about as fast as can be coded I think (uses a look up table stored in a single long and some shifting) and could extend this but I just remember that someone posted something really clever that I think could track several encoders at a very high frequency. Can't believe I have lost it.

    Graham

    p.s. my code which was someone else's idea implemented by me is here:

    http://forums.parallax.com/showthread.php?p=617168

    It does a single encoder at 1.3Mhz including write to hub memory.

    Post Edited (Graham Stabler) : 8/4/2009 11:22:01 PM GMT
  • TimmooreTimmoore Posts: 1,031
    edited 2009-08-05 00:24
    You can change Jeffs version to speed it up for 6 encoder only by unrolling the loops. It does most of the encoder processing at the same time and you only have to unroll and interleave the +/- and hub access. I estimate you can get 350K on a 80Mhz or 440K on 100Mhz. Heres a partial hack so you can see what I mean, I didn't fix the initialization code.
    qe.spin 34.7K
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-08-05 11:02
    Thanks for that, I might try that or do something similar with my code.

    What is bugging me is that I am sure I read about some clever method for doing it with counters or something and I am starting to think I am going mad. Particularly as I was sure Phil wrote it and even emailed him.

    Graham
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-05 15:08
    Graham,

    You may be thinking of this thread: http://forums.parallax.com/showthread.php?p=742749. It uses the counters to generate quadrature output.

    -Phil
Sign In or Register to comment.