Shop OBEX P1 Docs P2 Docs Learn Events
program flow and cogs — Parallax Forums

program flow and cogs

jdoleckijdolecki Posts: 726
edited 2011-07-07 13:54 in Propeller 1
I have 2 10 bit encoders on my robot base

1 for the drive motor and 1 for steering motor. along with that I have 2 voltage and current monitors for each battery.

Should I put each encoder on its own cog and both the V/I monitors on a cog also?

thanks for the help

john

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-07-07 12:11
    Here's the answer to all your questions: It depends.

    It depends on what objects you want to use. Have they already been written? How fast to you need to monitor the sensors/encoders?

    Right now I'm working on a robot with four quadrature encoders and four motors. I'm using Kye's PWM PID object that adjusts the PWM to the the motor based on the encoder readings. The problem is Kye's object uses one cog per motor. The four motors use up four cogs.

    I have to decide if it's worth having some extra cogs to write my own motor driver.

    So it's always a trade off. The easy thing to do is throw a cog at the problem. I bet there are many Propeller projects (mine included) that use many cogs that could probably get by with one, but with a lot of work to keep the timing correct.

    Duane
  • John AbshierJohn Abshier Posts: 1,116
    edited 2011-07-07 13:54
    The Quadrature Encoder.spin object in the Prop Tool Library will read both encoders and only use one cog. It does require that the inputs from the encoders be contiguous.

    John Abshier
Sign In or Register to comment.