Using a optical coder


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    23

    Default Using a optical coder

    Hello all

    In my new project I will use a optical coder for to know the position of tool (lathe)
    Optical coder is a 300 pulses/turn
    A full rotation of my lathe is equal 5 millimetres
    A pulse >>> 1,6/100 millimeters


    First problem
    I dont' know how to write this piece of code currently I calculate only the integer,a starting point please?
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi debutpic,

    Here's one way to do it.
    Code:
    Pulse_Rev  CON  300  ' Pulses per Rev
    Dist_Rev   CON  500  ' Distance per Rev in mm*100
    Position   VAR  WORD
    
    Position = Compteur * Dist_Rev
    Position = DIV32 Pulse_Rev
    And, Ingvar will be along shortly to show you how to do it with "*/"
    <br>
    Last edited by Darrel Taylor; - 27th December 2005 at 11:24.
    DT

  3. #3
    Join Date
    Dec 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    he he It work fine Darrel !!

    perhaps a another question,the optical coder has only one output TTL.
    I count the pulses with the pin RB0/INT but how to know if it turns in a direction or the other?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Unless you have some other way of knowing which way it's going, I don't think you can.

    If it needs to keep track of absolute position in both directions, you'll probably need a "Quadrature Encoder".
    <br>
    DT

  5. #5
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Talking

    I try hard not to ......

  6. #6
    Join Date
    Dec 2005
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Hello all

    1) Which is the method of programming used for to know the directions of rotation with these optical coders?

    2)the next opticals coders agree?

    thank's
    Attached Images Attached Images  

Similar Threads

  1. 2 Beam Optical Pulse Generator
    By WOZZY-2010 in forum Schematics
    Replies: 8
    Last Post: - 6th April 2010, 04:03
  2. Home made optical rencoder issues
    By Elnino in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th November 2009, 22:17
  3. USB Optical mouse as motor encoder
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th August 2008, 15:09
  4. optical voice link
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th May 2008, 21:11
  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