encoder HEDL 5540


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Posts
    21

    Default encoder HEDL 5540

    hi everyone,

    My question is about getting info from a maxon dc motor. I'm using HEDL 5540, and pic18f4550. So I started to search the forum for an interface code. Many thanks to mister e, I found the code (which was posted 3 years ago... The first thing in the morning, I will try the code.)
    Also can u pls help me about the definitions, what should I include for such a code to work, and why?

    Actually my main concern is about the HEDL 5540 datasheet. In the datasheet they are showing SN75175 as data receiver. But, when I was reading some of the posts in the forum, I got the feeling that it is somehow possible to connect encoders directly to pic, without any data receiver. I'm new at designing such things and it really confused me...

    Thanks...
    '
    ' ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    '
    GetEncoder:
    ' ===========
    '
    ' Procedure to get value change from rotary encoder
    ' 1. Read variant of rotary encoder (move, enter pushbutton)
    ' 2. Store result in 'MenuChoice' & 'MenuPointer' variables
    '
    ' Resume conditions:
    ' ------------------
    ' 1. Encoder Move
    ' 2. PBEnter button is pressed
    ' 3. User move to previous menu
    '
    ' ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    '
    OldPos = (PORTB & %11000000)>>6 ' get only PORTB<7:6> bits
    NewPos = OldPos
    '
    ' -----------------------------------------------------
    ' see if encoder has move or if ENTER button is pressed
    ' -----------------------------------------------------
    while ((NewPos==0) or (NewPos==3)) and PBEnter
    NewPos = (PORTB & %11000000)>>6 ' get only PORTB<7:6> bits
    wend
    pause 20 ' debounce delay
    '
    ' --------------------
    ' Get encoder movement
    ' --------------------
    '
    ' Rotary encoder output table (clockWise rotation):
    ' -------------------------------------------------
    ' 00
    ' 01 between move (half detent)
    ' 11
    ' 10 between move (half detent)
    '
    ' Using XOR
    '
    ' OldPOS : 0 0 3 3
    ' NewPos : 1 2 1 2
    ' movement : CW CCW CCW CW
    ' XOR -------------------------------
    ' 1 2 2 1
    '
    ' So, if NewPos XOR OldPos = 1 => increment
    ' Newpos XOR OldPos = 2 => Decrement
    '
    Newpos=newpos ^ oldpos
    select case newpos
    '
    case 1
    menuchoice=menuchoice+1
    Menupointer=menupointer+1
    '
    case 2
    menuchoice=menuchoice-1
    Menupointer=menupointer-1
    '
    end select
    '
    ' ---------------------------
    ' test the actual menu choice
    ' ---------------------------
    ' if higher than the maximum menu item... stay there
    '
    If menuchoice > Item then
    menuchoice = Item
    menupointer = thisSCREENLINES
    endif
    return

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default

    Hi kutsi,
    Actually my main concern is about the HEDL 5540 datasheet. In the datasheet they are showing SN75175 as data receiver. But, when I was reading some of the posts in the forum, I got the feeling that it is somehow possible to connect encoders directly to pic, without any data receiver. I'm new at designing such things and it really confused me...
    Yes, the HEDL series encoders has linedrivers in them, thats where the L in the part-number comes from. It's a good idea to use a line reciever chip with them but you dont HAVE to. Just use the two non inverted signal lines (seems to be pin 5 and 7 on my data-sheet) from the encoder and connect them to the PIC - you should be fine with that.

    /H.O

  3. #3
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default thanks for the help

    it works...

  4. #4
    MMUKPEKI's Avatar
    MMUKPEKI Guest


    Did you find this post helpful? Yes | No

    Thumbs up If you ever need me...

    Hey all!

    I got bored one day and was flicking through random forums and I came across this one. If you ever get stuck with the encoder and a PIC (cos I'm a PIC programmer too), e-mail me on [email protected] and I should be able to help you out.

    Have fun!

    Pete.

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. Instant Int and encoder (Elect. Gearing)
    By boroko in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 29th November 2009, 03:29
  3. Best quadrature encoder for buck?
    By jrprogrammer in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd June 2009, 14:58
  4. Reset timer / encoder transition
    By DJEE in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 22nd June 2007, 15:37
  5. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 22:56

Members who have read this thread : 1

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