EP4-100 single-ended encoder output

Discussion in 'Embedded Systems and Microcontrollers' started by ryanm222, Jul 19, 2012.

  1. ryanm222

    Thread Starter New Member

    Jul 19, 2012
    2
    0
    Hi,
    I am new to this site and new to encoders so bear with me. I am using the EP4-100-079-D-H-T-B single-ended encoder on a 200 RPM motor, and I am not getting the frequencies I expected. I hook one of the output channels to an oscilloscope and get a clear square wave except the frequency is about 1.0 kHz when I am running the motor at about 20-30 RPM when I excepted the frequency to be about 33-50 Hz. The encoder is hooked up to a 5V supply as specified. Am I getting the correct output or is something causing the frequency to be high? Any ideas on what could be wrong? Any help is greatly appreciated.

    Ryan
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    Your calculations are OK, I think, for the E4P-100.
    But if you mistakenly used an E4P-300 at 200rpm, you'd get the 1Khz. How are you measuring the shaft speed now?
    Other than that, don't know.
     
    ryanm222 likes this.
  3. ryanm222

    Thread Starter New Member

    Jul 19, 2012
    2
    0
    Problem Solved. Thank you for the input though. There was some misunderstanding of the RPM. The axle off the motor had 20 RPM, but the motor was spinning x30 because of the 30:1 gear ratio.

    But now I have another question/problem. I call interrupts in my C code every time there is a rising edge in the pulses from the encoder. It reads perfectly up until it hits about 245 Hz. Once it hits that, The interrupt triggers 3 or 4 times, and then doesn't trigger at all after that. If I decrease the frequency below 245 Hz, it goes back to working perfectly. So the interrupt abruptly stops when reaching >245Hz. Any ideas as to what could be causing an interrupt to work a 3-4 times at that frequency and then just stop? The interrupt still gets called at the frequency, just stops after a few calls.
     
  4. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    You did not say what you are using, presumably some microcontroller, or your IRQ setup, XTAL speed etc. but that's what it smells like so far..

    First find out. Take an unused output line (or temporarily reassign one) and set it when you enter the IRQ service routine, clear it when you leave. Compare the high-time on a scope vs. the encoder output. If the service time approaches the time between IRQs.. well, there you go.

    Using C, fast IRQs can be problematic since you don't have direct control over the code generated and therefore, can't predict the IRQ response. I've used both C and ASM successfully but, despite the lively C vs ASM discussions on another thread, usually wind up at least tuning the 'C' for best (smallest, fastest) code generation. When really pushed, its assembler for me.

    If that's what it turns out to be, I can suggest some ways to speed things up, especially if you're using PIC. In any case post some particulars (processor, XTAL, IRQ config interrupt on 1 or both phases etc. and what kind of processing you are trying to do in the IRQ routines) and we can take a look at it.
     
    Last edited: Jul 23, 2012
Loading...