HEDS5540 optical encoder


Results 1 to 24 of 24

Threaded View

  1. #15
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: HEDS5540 optical encoder

    But the precision is terrible, can you explain me the right way?

    157/1440 = .109 mm per encoder tick

    .109 * 256 * 10 = 279

    distance * 10 = (counts * 279)/256

    to use pbp's higest resolution integer functions

    Code:
    counter = enc_counter */ 279 
    
    lcdout  Dec counter/10 ,".", dec counter//10     ; display counter value on LCD
    problem here is that when enc_counter > 60000 [or thereabouts] the internal 32bit result will overflow and the result will be wrong
    you could look at nbit math


    ps you could also use div32

    Code:
    counter = enc_counter * 1000
    counter =  div32 917
    
    lcdout  Dec counter/10 ,".", dec counter//10     ; display counter value on LCD
    Last edited by richard; - 5th October 2016 at 01:27.
    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