Rotary encoders


Results 1 to 6 of 6

Thread: Rotary encoders

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    O.K. after reading my post i realize how stupid i'm now ;(

    encoder is connect to PORTD.0 and PORTD.1

    here's the code:

    Code:
    value=127
    
    GetInitial: 
    OldPos = PORTD & $3
    NewPos=OldPos
    
    while (NewPos==0) or (NewPos==3)
          NewPos = portd & $3
    wend
    
    select case NewPos
           case 1
                select case OldPos
                       case 0
                            value=value+1
                       case 3
                            value=value-1
                end select
           case 2
                select case OldPos
                       case 3
                            value=value+1
                       case 0
                            value=value-1
                end select
    end select
    
    lcdout $fe,$c0,dec value
    goto GetInitial
    Any improvement will be apreciate. But it works really well

    sorry for that

    regards
    Last edited by mister_e; - 12th October 2004 at 04:42.
    Steve

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

Similar Threads

  1. Calculate Distance Using Rotary Encoder
    By guanerrr in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 4th May 2012, 16:40
  2. Quick thoughts: DT Ints with encoders
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 7th January 2010, 01:01
  3. Rotary encoder help (not 'counting steps)
    By Elnino in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th October 2009, 22:03
  4. quad encoders
    By cpayne in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2007, 17:49
  5. Farnell's Rotary Encoder 733-726
    By crematory in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th October 2005, 13:51

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