Using an incremental rotary encoder?


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Using an incremental rotary encoder?

    I've never used one of these devices before. It has a resolution of 12 ppr. Please give me some advice on how to use the encoder. What command statement works best for reading the pulses? I'm guessing PULSIN How does the PIC recognize whether the encoder is turning clockwise or counter clockwise?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Using an incremental rotary encoder?

    I did some research and I now understand that phase A sends a pulse when turned clockwise and phase B sends a pulse when turn counter clockwise. 12ppr? Does that mean 12 pulses for each detent, or an entire rotation?

  3. #3
    Join Date
    May 2009
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Using an incremental rotary encoder?

    ppr=pulses per rotation.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: Using an incremental rotary encoder?

    did some research and I now understand that phase A sends a pulse when turned clockwise and phase B sends a pulse when turn counter clockwise
    That really depends on the encoder. Most I've seen (if we're talking about the ones used to replace a pot and knob) are quadrature output and even those come in different flavours. Some have one detent per qudrature cycle, some have four detents per qudrature cycle and some doesn't have any detents.

    Here's an example I already had in my attachments on the forum. This specific encoder has a full cycle per detent.

    Name:  Encoder output.JPG
Views: 1284
Size:  18.2 KB

    /Henrik.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Using an incremental rotary encoder?

    I think I've got it now. I'm not really using a command statement like PULSIN. I'm simply checking the state of the two pins connected to the encoder and I can use the XOR operator to interpret the Gray code as moving CW or CCW. Does that sound about right?
    Last edited by keithv; - 12th January 2016 at 22:09.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,544


    Did you find this post helpful? Yes | No

    Default Re: Using an incremental rotary encoder?


Similar Threads

  1. Reading incremental encoder interupt
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 1st March 2017, 13:50
  2. New approach to Rotary Encoder
    By Ioannis in forum Code Examples
    Replies: 90
    Last Post: - 11th July 2013, 22:05
  3. Calculate Distance Using Rotary Encoder
    By guanerrr in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 4th May 2012, 17:40
  4. Rotary encoder help (not 'counting steps)
    By Elnino in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th October 2009, 23:03

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