How read a motor encoder


+ Reply to Thread
Results 1 to 8 of 8

Thread: How read a motor encoder26 days old

  1. #1
    Member Frizie's Avatar
    Join Date
    Apr 2003
    Posts
    181
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    741.23 MB

    0 Not allowed!

    Question How read a motor encoder

    Hi Proton Users!

    What is the best way to have a motor encoder read in by the PIC?
    I get a lot of pulses (about 4,000 to 10,000 per second, depending on the speed of the motor) on two shifted (A and B) channels, so that the direction of rotation can also be determined.
    Earlier I did it with TCKI from a counter module, but then I only had one channel that only has to counts up.

    Now I have to count up or down depending on the direction of rotation of the motor.

    I convert the number of revolutions to a distance traveled, so if the motor (of a machine) goes in reverse, the distance has to count down again.
    There have been PICs with a Quadrature Encoder Interface (eg 18F4431) in the past, but there weren't many types of them so I suspect something like that should be done differently, but how?
    Does anyone know a nice way?

    Thanks in advance.
    Frizie.
    Ohm sweet Ohm: www.picbasic.nl

  2. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    193
    Thumbs Up
    Received: 8
    Given: 15
    Total Downloaded
    3.16 GB

    0 Not allowed!

    Default Re: How read a motor encoder

    Flosi Guđmundsson
    Reykjavík

  4. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: How read a motor encoder

    Frizie,

    Flosigud code is very good. It uses interrupt.

    Recently I tried something without interrupt, just to try an encoder. See this thread, post #35.
    Regards

    Joseph

  6. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Member Frizie's Avatar
    Join Date
    Apr 2003
    Posts
    181
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    741.23 MB

    0 Not allowed!

    Unhappy Re: How read a motor encoder

    Hmmm, I already thought it would be an interrupt solution.
    Unfortunately, this gives a lot of interrupts while I also have a lot of communication with the outside world, so I am afraid that it will disturb communication data and/or miss encoder pulses.
    I was hoping for a solution with a TMR module or something.
    Anyway, thank you for thinking along.

    ______________________
    Just for the webmaster.
    Why is this site not secured (https)?
    I find out that people who using Kaspersky cannot view the site completely or at all because it is being blocked.
    You have to change the password here every six months (which bother me a lot), but the site itself is not secured
    99.9% of the websites are secured.

    Frizie.
    Ohm sweet Ohm: www.picbasic.nl

  8. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: How read a motor encoder

    Why not dedicate a PIC device to reading the encoder and sending the result on demand?
    George.

  10. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    193
    Thumbs Up
    Received: 8
    Given: 15
    Total Downloaded
    3.16 GB

    0 Not allowed!

    Default Re: How read a motor encoder

    It is also possible to turn the interrupt off when not needed or clashes with something else.
    Flosi Guđmundsson
    Reykjavík

  12. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Member Frizie's Avatar
    Join Date
    Apr 2003
    Posts
    181
    Thumbs Up
    Received: 2
    Given: 1
    Total Downloaded
    741.23 MB

    0 Not allowed!

    Smile Re: How read a motor encoder

    Quote Originally Posted by towlerg View Post
    Why not dedicate a PIC device to reading the encoder and sending the result on demand?
    Thanks George.

    I think this is the best solution for now.

    Frizie.
    Ohm sweet Ohm: www.picbasic.nl

  14. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    195
    Thumbs Up
    Received: 8
    Given: 5
    Total Downloaded
    331.75 MB

    0 Not allowed!

    Default Re: How read a motor encoder

    For tight condition would be preferable dedicated IC. Otherwise for a single encoder it might be useful to use a timer input and just a periodic check that the rotation doesn't reverse.

  16. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 22
    Last Post: 25th October 2015, 18:22
  2. Rotary Encoder
    By all77 in forum Proton Plus Compiler v3
    Replies: 13
    Last Post: 12th June 2014, 17:01
  3. [SOLVED !] Rotary encoder help again...
    By staffstony in forum Proton Plus Compiler v3
    Replies: 68
    Last Post: 6th September 2008, 14:00
  4. Quadrature encoder
    By See_Mos in forum Labcenter Proteus VSM
    Replies: 2
    Last Post: 21st November 2006, 16:22
  5. optical encoder
    By Eliott in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 28th October 2006, 20:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts