Quad encoder problems


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Smitty,

    You said "Look at the code in the Interrupt Handler. Put this in your main loop"

    Did you mean to compile just the code you listed or to add it to one of the others? If you meant by itself then it compiled just fine.
    Just use the "new code" in the last post by itself (I did the moving for you).

    It starts with Rot1:00 and Rot2:35
    Add something like this just below the variable declarations to give an initial starting value.

    RotEnc1_val = 0
    RotEnc2_val = 0


    OK. Do you have the datasheet for the encoders? I assumed (always bad) that they where mechanical encoders, similar to the one shown here. Hook-up as per the nice diagram.

    If they are not mechanical encoders, then they are optical. If so, they will have a Vcc, GND, ChA, and ChB. Also, no pull-ups (or downs) required.

    At least it looks like the code is working. More info please.

    Steve

  2. #2
    Join Date
    Sep 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Ok, I did just use the code by itself and I understand setting the variables to =0. Off to a good start

    The encoders are optical with no data sheet since I pulled them out of a ball mouse. There is an emitter, wheel with 36 slots, and reciever for each encoder. They are in the same mounting positions as when the mouse was a mouse. I just chopped off the pc board behind them and attached my wires. The emitters only have 2 pins, +5v and ground. The recievers have 3 pins, A,B, & +5v. I know this because I traced them back on the mouse board before cutting. I also checked another mouse to be sure. (I bought 4 of them to play with).

    With my original code (the really simple one a few posts back) nothing happened until I put in the resistors to ground. Thats the only reason they are in the circuit. The read out on the lcd also displayed channel A and B status and I could see 00 01 11 10 00 when rotated very slowly.

    I did try your code without the resistors and it didnt make any difference.

    I agree with you when you say we need to walk before we run. So I checked the outputs of the encoders with a logic probe. I am getting a high/low pulse out of each of the channels when they are rotated.

    Smitty

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by smitty505000
    So I checked the outputs of the encoders with a logic probe. I am getting a high/low pulse out of each of the channels when they are rotated.
    What voltage do they output on the channels? I haven't hacked any mouse encoders, so a google on that (or someone else on this forum who has could chime in) could help make sure the hardware portion is working properly.

    I do know the code is working now. I scared up 2 mech encoders, and hooked them up to an 18F4620 I have. Using the internal pull-ups on port B, worked without a hitch. I see no reason it wouldn't work on the 16F628.

    Steve

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 14:45
  2. Instant Int and encoder (Elect. Gearing)
    By boroko in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 29th November 2009, 02:29
  3. encoder HEDL 5540
    By kutsi in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th June 2007, 14:00
  4. quad encoders
    By cpayne in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2007, 17:49
  5. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 21:56

Members who have read this thread : 0

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