New approach to Rotary Encoder


Closed Thread
Results 1 to 40 of 91

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    How does this work? Since Enc=Aux=0, How can the If clause be true? There must be some pull-ups in PORTA pins.

    Ioannis
    Last edited by Ioannis; - 18th February 2013 at 10:02.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    Here's the initial approach, I've modified for my needs. It does not works, what may be the reason?

    Code:
    LEFT var GPIO.0
    RIGHT var GPIO.1
    COUNTER VAR word
    counter=128
    
    cycl:
    if LEFT=0 then                 'here is switch 1 of the rotary encoder
        counter=counter+1
        goto lcd
    endif
     
    if RIGHT=0 then                 'here is switch 2 of the rotary encoder
        counter=counter-1
        goto lcd
    endif
     
    goto cycl
     
    lcd:
    hpwm 1,counter,5000
    while (LEFT=0 or RIGHT=0):pause 10:wend
    goto cycl
    MCU is PIC12F683

  3. #3
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    well, I think I found the problem - it never treats inputs as inputs, despite a high level on LEFT or RIGHT, it still =0

    Seems like I need some command to configure pins as input?

  4. #4
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    TRISIO=%11111111

    does not helps

  5. #5
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    ANSEL = %00000000
    CMCON0 = 7
    this helped

  6. #6
    Join Date
    Sep 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    Quote Originally Posted by Ioannis View Post
    How does this work? Since Enc=Aux=0, How can the If clause be true? There must be some pull-ups in PORTA pins.

    Ioannis

    Sorry for the late reply
    See here and we will resolve the questions

    https://sites.google.com/site/proyec...le-con-16f628a

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: New approach to Rotary Encoder

    It seems very strange that I got an e-mail notification only today about this thread by dovegroup's reply.

    I am not very good at C but from your example, dovegroup, I think the variable x might change more than one at every step in rotating the encoder because of the bouncing effects.

    Ioannis

Members who have read this thread : 2

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