Can PBP read optical encoder damn fast? :)


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    If the encoder strip has 60 lines per cm then you can get a resolution of 240 counts per cm by counting all four edges of the quadrature cycle.

    If you're OK with 60 it makes it a lot easier (compared to 4x decoding) since, again, all you need to do is poll channel B on the rising edge of channel A and you have your count direction. Using a coupe of external NAND gates (or perhaps the CLC module if your PIC has one) you can decode that into two discrete signals, up & down. Feed those into two counters on they'll count for you while you PAUSE.

    If counting with software, polling the inputs, then using PAUSE, LCDOUT or any other command that takes longer to execute than the shortest time between two pulses WILL ruin the day - in which case resorting to interrupts or hardware counter is the only way. This is why I asked if the the counting should go on WHILE outputting to the DDS.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    As said above, there will be no LCDOUT or any other statements in the loop, except DDS updating. Regarding the precision, have not decided it yet, because have not build and have not heard maybe 10 readings per CM also will be ok....

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


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    I've found this: https://hackaday.io/project/122039-i2c-encoder-v2 - Ready firmware for the above mentioned PIC with I2C output. So what if I use this chip with that firmware to get data from encoder, and then use my PIC to send required data to DDS?

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    If I get it right, you will use a PIC to read a quadrature encoder, then communicate with I2C to another PIC and the second PIC will send the data to your DDS?

    Does this sound logical and efficient?

    You have a PIC then just do it! Use some lines in ISR and get the job done.

    After all, it is a good programming exercise! And the bonus is that you will be thrilled when finished! Don't be afraid of the ISR. A bit of work but you can do it!

    Ioannis

    P.S. what is your current PIC?
    Last edited by Ioannis; - 2nd June 2020 at 21:09.

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


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    I'm result-oriented person
    And knowing my programming skill, literally saying, I'd prefer to buy wheel, instead of inventing it
    I have many different PICs, but no software knowledge that deep to handle all this stuff

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    Have you read the specs for that HackADay thing?
    •It's support the standard rotary encoder and the RGB encoder
    •It's possible to set all the 7bit of the I2C address trough a SMD jumper
    •Dimension of 25x25mm or 0.98x0.98in
    •With the castellated holes is possible to connected several boards on the 4 sides
    •Possibility to solder the pull-up resistor on the I2C bus
    •3 General Purpose pins. (GP pins)
    •256byte of internal EEPROM divided in the 2 bank of 128 byte
    •Advanced configuration respect the first version
    •The maximum frequency of the A/B signal is 150Hz.
    Anything that sticks out?

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


    Did you find this post helpful? Yes | No

    Default Re: Can PBP read optical encoder damn fast? :)

    I am a terrible programmer but have done some ISR routines that also do things fast.

    If I can do it, everyone can do it! Try it and see how it goes. After all we are still here...

    I'd select a PIC of relatively recent 18F series so the famous DT INTS-18 will support it, follow the instructions for the DT INTS and do some test. See here: http://dt.picbasic.co.uk/INT16/DTINTS-18

    Nothing to be afraid of.

    Ioannis

Similar Threads

  1. HEDS5540 optical encoder
    By louislouis in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 11th October 2016, 23:23
  2. how to read ky40 mechanical encoder ?
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 25th October 2015, 16:22
  3. Probe to read quadrature encoder with DT_INT need help
    By phoenix_1 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 31st August 2009, 20:43
  4. USB Optical mouse as motor encoder
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th August 2008, 15:09
  5. Damn these low power PIC and other Microcontrollers
    By keithdoxey in forum Off Topic
    Replies: 8
    Last Post: - 12th November 2006, 21:52

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