Shop OBEX P1 Docs P2 Docs Learn Events
Encoder program — Parallax Forums

Encoder program

ShinXIIIShinXIII Posts: 8
edited 2010-02-21 20:05 in Accessories
I used HEDS-5700 Series Panel Mount Optical Encoders to connect with BASIC stamp, but stuck in the programming part.
I need it to give me some values about the turning angles of the vehicle. It seems damn difficult to me...
I tried to get the values of Channel A and B when it turns, which i get the following result:

Channel A: 1· 0 ·0 ·1
Channel B: 1· 1· 0· 0

I tried to compare values from both channels and with their previous value to find out the encoder is actually turning clockwise or anti-clockwise.
But it seems that the program failed which gave me no change in the values.
Hope could have someone to enlight me a bit.

P.S. My program was written with reference to the DigitalEncoderDoc.pdf

Comments

  • Brian_BBrian_B Posts: 842
    edited 2010-02-07 14:23
    ShinXIII,
    I'm not the best person to answer this but being no one else has touched it I'll try and help. I don't think this basic stamp is the best choice of micro to use with and encoder ,the sx would work better and there is a sample program in sx basic that does just that.
    There is a little trick thought that you can use with the basic stamp, you take a d-flipflop and hook A channel to SET and B channel to RESET. When you turn the encoder one way OUT will pulse , when turned the other way NOT OUT will pulse. this is a cheap and quick way to tell what direction the encoder is turning . I wish I could be of more help.

    Brian


    Edit: I went and checked on the flip-flop thing ,seems my memory on how it worked was wrong . Here is a link of how to do it the right way.

    http://profmason.com/?p=775

    [noparse][[/noparse]http://profmason.com/?p=775]

    why don't www links work anymore?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    "Imagination is more important than knowledge..." Albert Einstein

    Post Edited (Brian_B) : 2/7/2010 6:02:24 PM GMT
  • ercoerco Posts: 20,256
    edited 2010-02-21 20:05
    Your quadrature encoder is working properly. Google & Wiki are your best friends.

    http://en.wikipedia.org/wiki/Quadrature_encoder

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.