HEDS5540 optical encoder


Results 1 to 24 of 24

Threaded View

  1. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: HEDS5540 optical encoder

    easiest way


    Code:
    Flag var byte
    wsave VAR BYTE    $70     SYSTEM  ; alternate save location for W 
    enc_new VAR BYTE
    enc_old VAR BYTE
    enc_counter VAR WORD


    Code:
    asm    
    
        ;Read latest input from PORTB & put the value in _enc_new.
             MOVE?CB    1 ,_Flag
             movf    PORTB,W
             movwf  _enc_new
    
             ;Strip off all but the 2 MSBs in _enc_new.
    
             movlw    B'11000000'    ;Create bit mask (bits 7 & 6).
             andwf   _enc_new,F         ;Zero bits 5 thru 0.
    
             ;Determine the direction of the
    Last edited by richard; - 2nd October 2016 at 22:58. Reason: CASE SENSITIVE
    Warning I'm not a teacher

Similar Threads

  1. 2 Beam Optical Pulse Generator
    By WOZZY-2010 in forum Schematics
    Replies: 8
    Last Post: - 6th April 2010, 04:03
  2. USB Optical mouse as motor encoder
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th August 2008, 15:09
  3. optical voice link
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th May 2008, 21:11
  4. Using a optical coder
    By debutpic in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 16th October 2007, 04:57
  5. Using the optical sensor from a ball mouse
    By lsteele in forum General
    Replies: 5
    Last Post: - 5th September 2007, 16:45

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