Shop OBEX P1 Docs P2 Docs Learn Events
Problems reading digital encoder — Parallax Forums

Problems reading digital encoder

danielreisdanielreis Posts: 16
edited 2010-05-05 18:38 in BASIC Stamp
Hello guys,

I'm with a problem to read a digital contacting encoder.
It's an incremental encoder, with quadrature output.

I tried to use some codes, including the one that Chris posted here: http://forums.parallax.com/showthread.php?p=893416

But all codes I tried didn't work.

I don't have any other idea to make it works, can anybody help me?

Bye,

Daniel

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2010-05-05 15:54
    Circuit diagram?

    Is encoder itself working? - check with voltmeter while turning the shaft VERY slowly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-05-05 16:11
    bom dia Daniel,
    Can you please describe the encoder in more detail, and also what you mean by "didn't work". First check the hardware, to be sure each channel, "A" and "B" are outputting full 0 to 5 Volt swings. Maybe it needs a pullup resistor? Also that it puts out the expected pattern of 0 and 1 by running the following simple program and observing the pattern on the debug screen. It should be something like...
    00
    01
    11
    10
    00....
    and so on, running either forward or backward.
    ' asks user for pins to use for the encoder.  2 sequential pins, e.g. p12 and p13, enter 12.
    ' observe output as encoder turns very slowly   
    epin VAR Nib
    DEBUG CR,"Enter pin 0 to 14 for channel A, then B is one up: "
    DEBUGIN DEC epin
    DO
      DEBUG CR,BIN1 in0(epin),BIN1 in0(epin+1)  ' 
    LOOP
    



    See also www.emesystems.com/BS2fsm.htm#twobit

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 5/5/2010 4:17:05 PM GMT
  • danielreisdanielreis Posts: 16
    edited 2010-05-05 18:38
    Hello Tracy,

    I had already tried the code that it's in your website, about the two-bit quadrature encoder, but without success.

    I tested the code you just posted, but the sequence that appears at debug screen doesn't make any sense.
    The result on the screen change without rotating the encoder, and when I rotate the encoder, the result doesn't change.

    I also tried using the pull-up resistor 10k to 5V in channel "A" and "B", but doesn't work too.

    The encoder I'm using is ECW1J-B24-BC0024L

    We use that encoder in another product and it works normally, but I tested with the voltimeter while shafting and it didin't present any output.

    I will attach the encoder datasheet.
Sign In or Register to comment.