Shop OBEX P1 Docs P2 Docs Learn Events
quadrature encoders - Page 2 — Parallax Forums

quadrature encoders

2»

Comments

  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-05 14:40
    Two of those states are not illegal they just represent no change but you could put some other flag in the truly illegal ones.

    It would depend on the application I suspect but you could certainly have a flag or use the counters for a timeout.

    Graham
  • rjo_rjo_ Posts: 1,825
    edited 2007-06-05 19:14
    Graham,

    This is beyond cool.

    Would you consider offering this is in kit form?

    Rich

    With regard to the cornstarch... that kinda rules out lenticulars... you'd need a clear plastic.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-05 22:15
    Rich,

    Topic is quadrature encoders please don't let us "go off on one" but please have a look at my progress if you are interested:

    http://www.indoor.flyer.co.uk/3dprint.htm
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-07 23:03
    As expected writing to hub ram slows it down a bit, I get 1.6Mhz if not writing to hub ram and 1.31mhz when writing to hub ram.

    Attached is a demo program where the data is written to hub ram where it is accessed by the spin demo.

    Graham

    [noparse][[/noparse]edit, program now tested and working]

    Post Edited (Graham Stabler) : 6/11/2007 10:56:25 PM GMT
  • overthehilloverthehill Posts: 6
    edited 2007-06-08 20:10
    Not sure whats wrong with fastencoder.zip content but all I get displayed on screen is a 0
    It just will not show counted pulses. all the hardware works fine incomming pulses on P0,P1 just as before.
    Any clues Graham?

    Peter.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-09 00:37
    I'll have to test it out as I can't see anything obvious, should be able to do that on Monday night, at the moment all I have is a Windows Me machine. Oh for a laptop and a propeller dongle [noparse]:)[/noparse]

    Graham
  • overthehilloverthehill Posts: 6
    edited 2007-06-09 10:49
    Thanks Graham - this will help as I have no idea what the problem is!
    My understanding at the moment is a little limited- but working on it.

    Peter
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-11 22:56
    I have now corrected it, I just wasn't setting up the pin mask properly and I also spotted another little mistake related to pin selection and corrected it.

    I updated the above attachment.

    Graham
  • rjo_rjo_ Posts: 1,825
    edited 2007-06-12 05:34
    Graham,

    I took a look at the link... and as usual... I am more than impressed. I once tried to figure out a way to register barrier strips with images (for pseudo-holographic displays and the problem didn't get solved. I think your work solves it... if you put two printers together... and I think it might be patentable!

    But I am submitting to this thread because I am interested in this thread... I think this stuff is fundamentally important and represents a significant contribution by you.

    At the same time... with my rather deprived background I have some really simple questions.

    What exact encoder are you using?

    I seem to remember seeing one offered by Parallax, but I just tried to look at their products again and I don't see it.

    Thanks,

    Rich
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-12 10:10
    The code works with any digital quadrature encoder such as those by usdigital, agilent/avago and many others. The printer I made (which I repeat is not the topic of this thread) actually had an analogue encoder which produces two sine waves out of phase, I uses a dual comparator to convert these signals to normal digital ones.

    Graham
  • overthehilloverthehill Posts: 6
    edited 2007-06-13 10:55
    Graham,

    Thanks for looking at the encoder object.
    It all runs perfectly and is very neat.
    I would recommend it to all.
    So do you do all this only for fun or do you take on commercial jobs as well?

    Peter.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-06-13 12:54
    I can always use extra pocket money let me put it that way.

    Graham
  • johnnyairplanejohnnyairplane Posts: 25
    edited 2007-08-01 04:47
    Hey,

    Hold it, if you decode an encoder, isn't that like being a self-contradicting optimist?
    or a meat eating vegetarian, or an off switch in the on position?

    You get the idea....


    The 'slightly nefarious' John
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-08-01 08:32
    Not unless you think having an encoder is like vowing to live in an encoded state, if that was the case the best thing to do would be to cut the A and B legs off that way you could be sure to keep the encoded data nice and safe away from those who might actually decode it [noparse]:)[/noparse]

    The alternative answer is... not really no the two things are not logically comparable because one describes a fixed state (vegetarian) where as the other describes a process.

    Graham
  • edited 2013-10-21 14:22
    I have already implemented the lookup-table algorithm mentioned by Skogsgurra and Chip on a Atmel328 20Mhz (pin change interrupt) in C with nice results. The problem was that there was no time to do something else :( As soon I have my new Activity Board I wil start testing the same C-function used for the Atmel, but... this algorithm in assembly must be the top. Jeff ???
  • MicksterMickster Posts: 2,694
    edited 2013-10-26 06:26
    As I was only concerned with a single encoder, I took a different approach in that I monitored only the two actual inputs of interest, CHA & CHB. No shifting or lookups required.

    No doubt this PropBasic code could be made more efficient but I literally threw it together and the generated PASM appears to never exceed 10 instructions and any time (excluding writing to the hub)

    I have since decided to offload my encoder-counting/PID/velocity-profiling to a dedicated device.
  • edited 2014-02-04 04:33
    I try to implement the ATmega328 C-code (see reply 10-21-2013) with SimpleIDE for the Propeler Mini, but get strange results. Two questions:

    1. Whats the max cristal for the PropelerMini?
    2. Has somebody implement a single encoder in C?
  • PublisonPublison Posts: 12,366
    edited 2014-02-04 08:10
    I try to implement the ATmega328 C-code (see reply 10-21-2013) with SimpleIDE for the Propeler Mini, but get strange results. Two questions:

    1. Whats the max cristal for the PropelerMini?
    2. Has somebody implement a single encoder in C?

    The Max crystal semi-approved by Parallax is 6.25MHz, (read the disclaimer). This will run the Prop at 100MHz with PLLx16. Others have run in excess of 114MHZ, but it takes very careful design considerations.
Sign In or Register to comment.