Quad encoder problems


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by smitty505000
    The encoders output a positive voltage between ~1.85 and 5 and I have 4.7K resistors pulled to ground on each channel.
    So it's never 0V? @1.85 you're probably sometimes in-between Low and High logic Level. You may need to 'filter' it a little bit to avoid oddity.

    1.Use the internal voltage comparator, set the threshold and use their interrupt to increment the counter.
    OR
    2.try something like...
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1067&stc=1&d=115794620 6">
    maybe one diode could be enough... maybe not
    HTH
    Attached Images Attached Images  
    Last edited by mister_e; - 11th September 2006 at 04:54.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Sep 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    I got it working! Sort of. I played arround with different value resistors and some diodes as sugested by mister_e and ended up with 30K resistors. Also seams my pic16f628-20p dosnt have a very accurate osc in it. I hooked up an external resonator and it works at 20mhz using Steve's slightly modified code from post #12. Thanks Steve!
    The only thing now is it sometimes skips or looses count. Either the pic running at 20mhz cant keep up or the infrared red rx cant keep up. These encoders came out of a PS2 computer mouse. The ones that turn off the ball.

    Any ideas guys?

    Thanks!
    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
    I got it working! Sort of. I played arround with different value resistors and some diodes as sugested by mister_e and ended up with 30K resistors. Also seams my pic16f628-20p dosnt have a very accurate osc in it. I hooked up an external resonator and it works at 20mhz using Steve's slightly modified code from post #12. Thanks Steve!
    The only thing now is it sometimes skips or looses count. Either the pic running at 20mhz cant keep up or the infrared red rx cant keep up. These encoders came out of a PS2 computer mouse. The ones that turn off the ball.

    Any ideas guys?

    Thanks!
    Smitty

    Now your walking, time to RUN!! Go back to post #6 and give the interrupts a try. With the optical encoders and interrupts, you should have not any switch bounce, and you should also not have any "skips". Well, if it turns faster than the interrupts can process the inputs, you can have some skips, but the nice thing about the interrupts is that the updates to the rotarty encoders count will not "wait" on the LCD output to finish.

    Give it a shot,
    Steve
    Last edited by SteveB; - 17th September 2006 at 02:01.

  4. #4
    Join Date
    Sep 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Steve,
    I am ready to run but cant get it to compile. I am not sure what I am doing wrong. Did you get it to compile?

    Thank you for all your help!

    Smitty

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


    Did you find this post helpful? Yes | No

    Default

    Yes, it compiles. You need to use Microchips Assembler instead of the MeLabs. What errors are you getting? (Are you using MicroCode Studio?)

  6. #6
    Join Date
    Sep 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Hey Steve,

    I have tried microcode studio and microchips mpasm. I think I might have a problem with mpasm talking to pbp or I installed something wrong. I was going to unistall everything and try again but my pbp is on a floppy and I found out my floppy drive (havent used it in years! LOL) is bad. I ordered a new one and will have it by the end of the week. Its amazing how cheap a floppy drive is these days. I also ordered my first Oscilloscope! Its only a BK precision 2120b 30mhz dual channel but it should be able to handle everything I do.

    Thanks,
    Smitty

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


    Did you find this post helpful? Yes | No

    Default

    I think others may have had the same problem. DynamoBen recently got his to work. Maybe he can help sort out whats wrong. He mentions that he "changed the registry", but no specifics. Not having had a problem with my setup, I'd just be guessing.

    The other alternative is writing the interrupt routine is ASM. Better to get your compiler/assembler arrangement working properly.

    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