Shop OBEX P1 Docs P2 Docs Learn Events
Timing — Parallax Forums

Timing

fma38fma38 Posts: 42
edited 2007-06-06 14:07 in BASIC Stamp
Hello,

Ok, so, for my motorized panohead, I will have to read quadrature encoders. I plan to use a LS7084, which is a quadrature clock converter, outputing clock and dir. It is also able to divide the clock by 4.

So, I will have to count pulses at about 1.1kHz. Is it possible to do that with a BS2px? Is it fast enough to read pusles and cmpute a pid to drive the motor?

If not, do you know where I can buy a LS7366 (a quadrature encoder counter, with SPI interface)?

Does Parallax plan to make a nice module to read 2 quadrature encoders, with internal counters, with a serial interface? It could be very interesting...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr

Comments

  • metron9metron9 Posts: 1,100
    edited 2007-06-05 21:00
    You say you need to read them at 1.1khz but what is the data processing timing like as well as the output you intend to do?

    Are these bursts of 1.1khz with a known time between bursts?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • fma38fma38 Posts: 42
    edited 2007-06-05 22:26
    The goal is to drive an axis to a specified position. This axis is driven by a DC motor, and its position is read through the quadrature encoder. At full speed, the pusles of the encoder, after the LS7084 and its x4 divder, is 1.1kHz, but I don't know exactly what is the time between bursts; this is depending of the rotation of the axis.

    I will drive the motors with a pololu module, readback the encoder position, compute a pid close-loop, and correct the motor speed if needed, until I reach the requested position.

    Hope this is more clear...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • metron9metron9 Posts: 1,100
    edited 2007-06-06 03:33
    The BS2px would allow about 19 instructions per millisecond. If your pulse is high for 0.55mS and low for 0.55ms that would be 1.1 khz. so you may only have 9 instructions you can execute per pulse transition. If that is correct you still need to communicate with pololu module (and I don't even have a clue what that might be.) Since there are no interrupts to keep track of the pulses and buffer them during communication with the pololu I don't think it will be fast enough. What I am trying to get across is that you have the amount of time between pulses to do something, without interrupts that something has to finish what it is doing before waiting in a loop again for the next transition. With interrupts the transitions can happen and be caught automatically by the hardware and take only microseconds to execute between lines of code automatically. I think you should be looking at the SX, there you have at 50mhz upwards of 50,000 instructions in between pulses from the encoder, and you said encoders. Each encoder should be set up with its own interrupt and ISR routine to track the movement while your main program reads the data stream and outputs control signals to the pololu module. Course I don't know what the whole design looks like but that would be my initial observation for what I think you have going.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • fma38fma38 Posts: 42
    edited 2007-06-06 05:53
    Ok, thanks for the explanation. The Pololu module is a DC motor driver, communicating via serial line. I guess it will take too much time to the Stamp when it will write to it.

    I think I will have to use dedicated IC to keep track of encoders position (like LS7366). That's why I would like a Parallax or third party module...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-06 14:07
    Something to keep in mind when calculating instructions per second…you may notice we list approximate instructions per second since the number of instructions per second really depends on the instructions being run. For example, you won’t get as many instructions per second if you do a PAUSE or SERIN/SEROUT statement because these take longer to execute. The same could be said for FREQOUT, PULSOUT and RCTIME, since the execution time will vary. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.