Rotary encoder help (not 'counting steps)


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You could use "INTERRUPT ON CHANGE" which uses portB.4 to portB.7. You could connect Chan A of X axes to portB.4 and chan B of same axes to portB.5 while axes Y will use portB.6 and portB.7 in the same way.

    In the interrupt routine you will increment a variable for X axes and one for Y axes. using the timer0 or timer1 overflow you will read the variable and extract the speed, once you have done that you will zero both variable for the next reading.

    Since you will count both channels you will be able to detect also the direction setting a direction flag in function of the channel sequence.

    As far as interrupt on change, is concerned you could take advantages from Darrel Taylor instant interrupt routine, simple to use and very relaible indeed.

    Al.
    All progress began with an idea

  2. #2
    Join Date
    Sep 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Excellent, Thanks Al! that's exactly the headstart i needed. Time to get coding... (and checking out how these interrupts work...)

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    SteveB might have something for you that goes along with arrati's suggestion ...

    http://www.picbasic.co.uk/forum/show...5396#post25396
    <br>
    DT

  4. #4
    Join Date
    Sep 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Thanks DT, that's pretty darn close to what i need.
    Last edited by Elnino; - 26th October 2009 at 23:31.

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 15:45
  2. Calculate Distance Using Rotary Encoder
    By guanerrr in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 4th May 2012, 17:40
  3. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 22:56
  4. Farnell's Rotary Encoder 733-726
    By crematory in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th October 2005, 14:51
  5. Automotive quality rotary encoder
    By d1camero in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th October 2004, 16:46

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