Probe to read quadrature encoder with DT_INT need help


Results 1 to 12 of 12

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Connect encoder channel A to portB.0 (I assume you already have it) and channel B to portB.1. Since channel A is out of phase on channel B turning your encoder CW channel A will be high before channel B and turning it CCW channel B will be high first.

    In your interrupt handler check the above conditions

    Code:
    If portB & %00000011 = 1 Then
    a = a + 1
    CW = 1
    Else
    a = a - 1
    CW = 0
    Endif
    If variable CW is 1 then your motor is turning clockwise if CW = 0 then is turning counterclockwise, while word variable a will contain the updated count.

    Al.
    Last edited by aratti; - 30th August 2009 at 22:57.
    All progress began with an idea

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. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  3. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  4. Write and Read from eeprom
    By savnik in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 9th June 2007, 14:56
  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