Slow Opto Encoder With Interrupts


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77

    Red face Slow Opto Encoder With Interrupts

    Hi all,

    I am making a trolly which is moved along a track with a belt. I made an opto encoder with a metal disk and the components from a ball mouse.
    I read the other thread on opto encoders and have it working great when using it alone in itīs own little loop. The problem is I need to do many other things in the mean time.
    The encoder is only 10 pulses per revolution and my motor at max goes at 10 RPM (it has a gearbox)

    I am trying to use Darrel Taylors great instant interrupts with my 16F877A. I have used them successfully many times but I am definately doing something wrong this time.
    It works only at very low speed (ie 10Hz) at 50Hz it just show A and B being permanently on.

    Can anyone guide me to what my error is. I have attached both my codes in txt format, the working one without INTs and the INT one that does funny things?

    Regards

    Chris
    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 Chris,

    It'll probably work better without the serout2 in the interrupt handler.

    In the first version (without interrupts), there was an attempt to limit the number of times that SEROUT2 was executed. (IF NUMBER<>COUNTER)

    But in the interrupt version, that disappeared, and it sends the result after every interrupt.
    Using up way too much time. (even at 38400 baud)

    Any time consuming Serial outputs should be done in the Main Loop, instead of the handler.
    <br>
    DT

  3. #3
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking A Ok

    Thanks Darrel, all works fine now, really your interrupts make hardware interrupts so much easer for those of us who are not good with assembler.

    Regards

    Chris R.

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 14:45
  2. Multi Slow speed PWM and Instant Interrupts
    By DaveC3 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd November 2010, 12:50
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  5. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 21:56

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