Shop OBEX P1 Docs P2 Docs Learn Events
Holding pos and PWM — Parallax Forums

Holding pos and PWM

ALIBEALIBE Posts: 299
edited 2006-03-31 20:00 in Propeller 1
I know this is a dumb newbie question - please bear w/ me.

Is propeller capable of taking a PWM and holding that PWM ? for example holding the position of a Servo?

Scenario:
let's suppose I'm building a propeller powered electric truck (autonomous)

#1: Set Servo pos to "go straight ahead" (via PWM)

#2: Main Loop
····· check obstacle sensors
····· check GPS Pos
····· check this, check that
·····
#3: Depending on values in·#2
····· Change Servo Pos to "take right turn" and "go straight ahead"

During #2, the servo holds position - no need to re-enforce servo pos durin #2

does this scenario apply to propeller

sorry if the scenario was needlesly descriptive

thanks
·····

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-31 19:58
    Sure -- what you would do is dedicate a cog to servo management. Andy Lindsay and Beau Schwabe have already started on projects, and I'm borrowing from Andy's work to create a "virtual" PSC (Parallax Servo Controller) that will manage up to 16 servos. In Andy's current program the main cog holds an array of servo positions (and the address of that array is passed to the servo management cog). When his mainline code updates a position value, the servo cog sees that an adjusts without any further interface. This illustrates the power of the Propeller's shared RAM.

    My version will work more like the standard PSC where the servo cog will hold everything and the any cog that wants to update a servo will do it through a PUBlic method. By doing this, I can incorporate the "ramp" feature of the PSC into the servo cog so the mainline code isn't burdened with that work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • ALIBEALIBE Posts: 299
    edited 2006-03-31 20:00
    that's cool. thanks

    the more i learn, the less i can wait...
Sign In or Register to comment.